Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Add new function to libcod on windows

  1. #11
    Private
    Join Date
    Jan 2015
    Posts
    12
    Thanks
    6
    Thanked 5 Times in 1 Post
    I tried this too, but the same issue with one sec connection interupted after call

  2. #12
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    You could just add an error check:

    PHP Code:
    recvfrom(Socketresponsesizeof(response), 000);
    if (
    == 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];
    recvfrom(Socketresponsestrlen(response), 000); 
    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:
    recvfrom(Socketresponsesizeof(response), 000); 
    timescale 0.01

  3. The Following User Says Thank You to kung foo man For This Useful Post:

    Kantin (9th January 2015)

  4. #13
    Private
    Join Date
    Jan 2015
    Posts
    12
    Thanks
    6
    Thanked 5 Times in 1 Post
    Thank you man! Its working strlen was a bad choice, with sizeof its ok!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •