You could just add an error check:
PHP Code:
i = recvfrom(Socket, response, sizeof(response), 0, 0, 0);
if (i == SOCKET_ERROR) {
Com_Printf("recvfrom failed with error %d\n", WSAGetLastError());
stackPushString("hurrdurr");
}
Would print: recvfrom failed with error 10040
Google: http://support.ipswitch.com/kb/WSK-19980714-EM13.htm
Question/Problem: Message too long.
Answer/Solution: A message sent on a socket was larger than the internal message buffer or some other network limit.
Check the size of your buffer:
PHP Code:
char response[1024];
i = recvfrom(Socket, response, strlen(response), 0, 0, 0);
Realize that strlen(response) is always 0, since empty arrays are initialized to zero.
Set the size with sizeof() instead and it will work:
PHP Code:
i = recvfrom(Socket, response, sizeof(response), 0, 0, 0);