Changing the Timeout with wxParmSet
Keywords: timeout wxparmset
Question:
I'm first wxpinging a server to see if it's up and running, and then using wxParmSet(5,1) to try to reduce the timeout to 1 second for sConnect to speed up the timeout. The problem is the wxParmSet(5,1) parameter doesn't have any effect on the timeout. Why isn't wxParmSet(5,1) not affecting the timeout?The way I do it until now. first i do a wxPing(ip) and if i get @true i try sConnect(talksocket1,ip,port) and if i get a connecting i send a request (sSendLine) ...
it's running but i want to make it faster. so i try to use only sConnect with a short timeout (1 second). so my problem ist: how can i reduce the timeout for sConnect?
Here is his sample code:
AddExtender("WWWSK32I.DLL") wxParmSet(5,1) start1=timeymdhms() talksocket1=sOpen() ret=sConnect(talksocket1,"123.123.123.123","123");using this socket for demonstration purposes err=wxGetLastErr() msg=wxGetErrDesc(err) Message(timediffsecs(timeymdhms(),start1),"Winsock Error A %err% %msg%") sclose(talksocket1) ;when my internet router is offline the sConnect needs 10 seconds wxParmSet(5,10) start10=timeymdhms() talksocket10=sOpen() ret=sConnect(talksocket10,"123.123.123.123","123") err=wxGetLastErr() msg=wxGetErrDesc(err) Message(timediffsecs(timeymdhms(),start10),"Winsock Error A %err% %msg%") sclose(talksocket10)Answer:
The wxParmSet(5,1) sets the timeout for a socket data transmission request once the socket has been established.There is no timeout for the sConnect that can be modified. Even if there were, making a short timeout would just result in a failed connection.
Article ID: W15101