Hej,
I've got a Problem with my Messenger I'm writing for Android. The Problem is, that the socket on the Phone AND on the PC connected without any problems. But they cant get the ObjectInputStream as well as the ObjectOuputStream (InputStream and OutputStream works fine :/ ). Not on the Phone nor the PC.
I cant find any solvings on Google; I was searching the whole day.... Is this normal due to some indifferences between the systems?
Thanx a lot for your help ;)
@Override
public void run() {
inputStream=null;
outputStream=null;
System.out.println("Streams initialized");
try{
inputStream=new ObjectInputStream(clientSocket.getInputStream());
System.out.println("Inputstream");
outputStream=new ObjectOutputStream(clientSocket.getOutputStream());
System.out.println("Outputstream");
SendObject sendObject=null;
System.out.println("Streams get");
connected=true;
while(inputStream!=null&&connected){
}
}catch (IOException e){
e.printStackTrace();
}
}
This is the code on the serverside (int the ThreadHandler), just stopping at the inputStream=new ...
And following, this is the code on the Smartphone
private void initNetwork(){
try {
Log.d("Networking","init");
final int SERVERPORT = 21000;
final String SERVERADRESS = "192.168.2.22";
socket = new Socket();
Log.d("Networking", "new Socket created");
socket.connect(new InetSocketAddress(SERVERADRESS, SERVERPORT), 3000);
Log.d("Networking", "Socket connected");
ois =new ObjectInputStream(socket.getInputStream());
oos =new ObjectOutputStream(socket.getOutputStream());
connected = true;
Log.d("Internet", "Connected");
}catch (InterruptedIOException e){
Log.d("Networking","Imeout");
}catch (IOException e){
connected=false;
Log.d("Internet","Not Connected");
e.printStackTrace();
}
}
The last log dislpayed by AndroidStudio is Log.d("Networking", "Socket connected");