I have written a server is java here is the code:
public mainClass()
{
try
{
ss = new ServerSocket(8080);
while (true)
{
From my own experience, readLine
is not a good idea, especially when working with different languages and platforms, a better approach will be to use InputStreamReader
and its read(char[] buff) method, and agree on both sides regarding the length to be sent each time.
Again, I have no reference to that, only my experience.
Also, looking at your code, you send a string without a new line character: [socket sendString:@"Hi This is a second test"];
maybe adding \n
at the end will solve it for you.