This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

a socket with timeout..

Old posts that have not been replied to for several years.
Locked
l
loze

a socket with timeout..

Post by loze »

set sock [socket <address> <port>]
how do i make a timeout? if it not is connected in 10 sec i want it to take next.. like php: fsockopen($adress, $port ,$errno, $errstr, 2);
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Your example is using Tcl sockets. You should use the -async option so that it returns immediately. Then set a timer for 10 seconds. If the socket hasn't connected before the timer executes, then kill it. If the socket does connect, kill the timer. See?

If you want to use eggdrop sockets, which are automatically asynchronous/nonblocking, you do the same thing.

In both cases, make sure you look up the domain name *first* because they will both block for that operation.
Locked