i already search for the same problem. some are helpful but i got this
weird error.
im making a tcp connection, have already successfully send my package
but when i try to read from the socket, it throw exception "Bad
Socket". im really confuse.
can any body help me about this?
any help will fully appreciated
this is part of the code :
Socket socket = new Socket("scs.msg.yahoo.com",5050);
DataInputStream dis = new DataInputStream(new
BufferedInputStream(socket.getInputStream()));
DataOutputStream dos = new DataOutputStream(new
BufferedOutputStream(socket.getOutputStream()));
dos.write(header);
dos.writeChar(len); // write 2 byte of length
dos.writeChar(service); // write 2 byte
dos.writeInt(status); // write 4 byte of status
dos.writeInt(sesionId); // write 4 byte of session ID
dos.write(bs.toByteArray()); // write body
dos.close();
Log.v(this.TAG,dis.readUTF()); // this part throw
exception.
fout.close();
} catch (IOException e) {
// TODO Auto-generated catch block
Log.e(this.TAG,e.getMessage());
e.printStackTrace();
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---