 <p>Some notes:</p> <ol> <li><p>To read/send data over network you need functions such as <a href="http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#sendall" rel="nofollow">this</a> and <a href="https://stackoverflow.com/questions/27527395/how-to-get-the-exact-message-from-recv-in-winsock-programming/27527668#27527668">this</a>. Because send and receive not always send/receive how much you told them to.</p></li> <li><p>You seem to use uninitialized variable <code>new_fd</code> which doesn't look nice.</p></li> <li><p>Finally after you have ensured all the data has been received that was sent(using the approach I mentioned in (1)), comparing strings is not issue - you can use just <code>strcmp</code>, assuming strings are null terminated.</p></li> </ol>