Raised This Month: $ Target: $400
 0% 

socket_recv() hangs?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
xOR
Veteran Member
Join Date: Jun 2006
Location: x-base.info
Old 07-02-2006 , 14:38   socket_recv() hangs?
Reply With Quote #1

searching the forum shows me that this has been posted before and the solution to this was that the people having this problem didn't check socket_change() before.
i do, and even did it right from the start. here is my code snippet:

Code:
            if (socket_change(g_naServerSockets[nServerCount], 1))             {                 // initialize our receive buffer                 for (nClearCounter = 0; nClearCounter < MAX_INFO_LEN; nClearCounter++)                     sRcvBuf[nClearCounter] = 0                 socket_recv(g_naServerSockets[nServerCount], sRcvBuf, MAX_INFO_LEN - 1)                 if (nCheckMethod == 1)                 {


i have added a log_amx() with a unique message directly before and after socket_recv() and the last message i see in console is the one that i placed before socket_recv() so there is no doubt that this is the place where the server hangs.
the weird thing is that all my 4 CS 1.5 servers are running fine for days with this code, while my one 1.6 test machine is crashing along with other 1.6 servers from other testers randomly. Once it was running for a whole night and some time later it crashes 30 minutes after start.
the 1.5 servers use AMXX 1.71 and the 1.6 servers are using 1.60 and 1.71.

i can only think of 3 reasons for this:
  • socket_change() is returning true although there is nothing new to receive and calling socket_recv() hangs the server
  • i understood something with the timeout wrong and should set it to a higher value
  • socket_recv has a bug and sometimes hangs even when there are changes

if you want to have a look at the complete plugin code get it from this thread. then just search for socket_recv in the source, as it is only used once within the code.

thanks in advance for any help and suggestions.




EDIT: oh and i just remembered that some time ago the original code had "while socket_change()...". i changed it to "if", because from time to time socket_change didn't stop to return true and the while loop got endless.
this would support my first suggestion that socket_change sometimes just returns true when it shouldn't.
__________________
Got more than one HL1 (CS, DoD, NS, TS, TFC, HLDM...) server? Check:

Last edited by devicenull; 07-05-2006 at 22:02.
xOR is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:07.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode