time out socket

Billy Ng evebill8 at hotmail.com
Sun Mar 17 13:10:15 EST 2002


Thanks Martin,

Good info!

Billy

"Martin von Loewis" <loewis at informatik.hu-berlin.de> wrote in message
news:j4pu235b3c.fsf at informatik.hu-berlin.de...
> "Billy Ng" <evebill8 at hotmail.com> writes:
>
> > Would anybody please tell me how time out the socket.connect() if
> > the host does not exists or is unable to connect, thanks!
>
> The connect call will time out eventually on its own, after the
> operating system's timeout has passed.
>
> If you want to shorten the timeout, and you have a Posixish system,
> you can set an alarm using signal.alarm. Make sure you install a
> signal handler; it does not need to do anything since the connect will
> raise EINTR.
>
> Regards,
> Martin
>
>





More information about the Python-list mailing list