Page 1 of 1

[Implemented] OpenNetworkConnection() timeout parameter

Posted: Fri Jun 13, 2008 7:54 pm
by Psychophanta
Yes, looking here:
http://www.purebasic.fr/english/viewtopic.php?t=32833
where Freak says:
(If you think OpenNetworkConnection() should have a timeout parameter, thats a feature request, not a bug.)
I remember that OpenNetworkConnection() blocked the running flow of the program while trying to connect to the server side, and other times it returned inmediately, so yes, i request for a timeout to make OpenNetworkConnection() to return or to keep trying. :)

EDIT:
At the moment we are forced to make workarounds like:

Code: Select all

Procedure MyOpenNetworkConnection(*conn.UTCSafe)
  *conn\connectionID=OpenNetworkConnection(*conn\UTCServer,*conn\port)
EndProcedure

Code: Select all

;... stuff ....
    Connection.UTCSafe\UTCServer=UTC(t):Connection\port=port.w
    Connection\connectionID=0
    Thread.l=CreateThread(@MyOpenNetworkConnection(),@Connection.UTCSafe)
    WaitWindowEvent(20)
    If WaitThread(Thread,1000)=0:KillThread(Thread):EndIf
; ... more stuff...

Posted: Fri Jun 13, 2008 11:43 pm
by Joakim Christiansen
I bet many would like something like this and I'm also one of them.

But I don't think it's too easy to make, since even when using the socket functions in windows there is no way to specify a timeout. At least not a simple way...