I made a server python with the next code (i think the rest of the code isn't necessary):
while 1:
data = conn.recv(BUFFER_SIZE)
if not data: break
print "received data:", data
conn.send(data+'\r\n')
conn.close()
and when i try to received the echo with a Java client, i get a strange message when printing on console:
Mensaje recibido = java.io.DataInputStream@1cf2a0ef
At server point, I'm receiving good the message: Hola Mundo.
The code in Java is:
DataInputStream ims;
String data;
s = new Socket(HOST,PORT);
oms = new DataOutputStream(s.getOutputStream());
ims = new DataInputStream(s.getInputStream());
oms.writeUTF(ms);
ims.read();
data = ims.toString();
oms.close();
ims.close();
s.close();
return data;
I think that ims.toString() is probably wrong.