Question: As part of strengthening session authentication security for a site that I am building, I am trying to compile a list of the best ways to register a user's computer as a second tier of validation - that is in addition to the standard username/password login, of course. Typical ways of registering a user's computer are by setting a cookie and or IP address validation. As prevalent as mobile computing is, IP mapping is less and less a reliable identifier. Security settings and internet security & system optimization software can make it difficult to keep a cookie in place for very long. 

Are there any other methods that can be used for establishing a more reliable computer registration that doesn't require the user to add exceptions to the various cookie deleting software?

Answer: 
Simply calling read doesn't guarantee that you will receive all the 63 bytes or that you receive the 63 bytes you were hoping for.. I would suggest that you somehow determine how much data you need to receive(send the data length first) and then put the recv function in a loop until you have all the data.. The send function(from the client) should be checked also.
Solution: The error was that the XOpenDisplay was inside an infinite loop without being closed. I simply moved the XOpenDisplay command before the infinite loop in dostuff().

It was in fact not a socket error.