Are you somehow establishing a UDP connection?
You should not be receiving out of order. My webserver (had to write it for an Operating System class -- the web part was not a class aspect..) simply receives with a:
Code:
while (recv(clntSocket, buffer, RECV_SIZE, 0) > 0);
You should not be receiving out of order, or any duplicates, with TCP. However, from the sounds of it, it sounds exactly like a UDP type issue.
As for your msg, you don't need all that extra fluff if you're just testing simple stuff:
Code:
char *msg = "GET http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2935 HTTP/1.1\r\nHost: www.maxim-ic.com\r\n\r\n"
Should work just fine (You only need the HTTP version, the GET, the item, and the Host).