perihanmirkelam / TcpServer

Socket programming example. Basic TCP Server application.

Home Page:https://perihanmirkelam.medium.com/socket-programming-on-android-tcp-server-example-e4552a957c08

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

readUTF seems to hang?

karlbrowns opened this issue · comments

Hi, many thanks for your tcpServer and tcpClient apps - I'm trying to use the tcpServer and testing it with netcat as suggested, but when it comes to the dataInputStream.readUTF() call it seems to hang, and nc and the app stall. If I changed it to loop reading just a single Byte with readByte then it worked, but that's a bit more limited. Is there anything else I can do?

Ok, I found something on stack overflow that says readUTF needs to receive data that has been written by writeUTF and using nc doesn't supply this - but it means that I should be able to make it work for me. Thank you again for providing such a good example.