You could just add an error check:
i = recvfrom(Socket, response, sizeof(response), 0, 0, 0);
if (i == SOCKET_ERROR) {
Com_Printf("recvfrom failed with error %d\n", WSAGetLastError());
...
You could just add an error check:
i = recvfrom(Socket, response, sizeof(response), 0, 0, 0);
if (i == SOCKET_ERROR) {
Com_Printf("recvfrom failed with error %d\n", WSAGetLastError());
...
To make sure this is not a non-blocked-recvfrom() issue, can you try:
sendto(Socket, data, strlen(data), 0, (SOCKADDR *)&server, sizeof(server));
Sleep(1000); // just to wait till there is...
Shouldnt data be terminated by \0? There is no room for it in the [9].
Your message should show up in wireshark. (https://www.wireshark.org/)
Try this. With the output you should be able to see if it worked.
void gsc_utils_foo() {
char *ip;
int port;
...
How do you call your function in cod2?
Like this
foo("1.1.1.1", 28962);
int port;
char *srt;
Can you post your changes? I can't say what is wrong with so little code. You could use Wireshark to see if your message gets send.
Also you could try debugging your function with printf (for...