How is the message array used after recv() ? If 220 bytes were received, then message[] won't be null-terminated which may be as required or may not depending upon what the following code expects.