The error source is in this line of the client:
r=recv(client,input,strlen(input),0);
The string variable
input
is not initialized and so
strlen()
returns a random value. You must pass the size of the buffer minus one to reserve space for the terminating NULL byte:
r=recv(client,input,sizeof(input)-1,0);
if (r >= 0)
input[r] = 0;
Do the same on the server side where you are passing the fixed buffer size of 256 (which must be 255).