I want to connect Android Device to external device via Socket. Socket Connect to external device successfully.
Now if any data require from external device then send re
You're doing this the hard way. Get rid of the ByteBuffer
altogether and use all the methods of DataOutputStream
. They are all big-endian. I can't see any mistake but clearly you must be sending something the peer didn't understand so he is closing the connection instead of sending a reply.
Note: Socket.isConnected()
cannot possibly be false at the point you're testing it.