On Sun, Apr 07, 2002, Erez Doron wrote about "c/unix question": > hi > > I am trying to open a tcp port to a server, did it and it works. > > now i blocked the server via firewall. > > trying to connect just hangs. > > how do i make 'connect' timeout ?
What is usually done is to use non-blocking connect(2) (see fcntl(2) and O_NONBLOCK), and then do a select(2) with a timeout to wait for this connect to finish (or close(2) on timeout). I suggest you take a look at Stevens' UNIX Network Programming for more information about this and other techniques (it's a big book, and contains many useful tips and techniques for socket programming in Unix). I don't know if a free quality alternative exists online. -- Nadav Har'El | Sunday, Apr 7 2002, 25 Nisan 5762 [EMAIL PROTECTED] |----------------------------------------- Phone: +972-53-245868, ICQ 13349191 |I put a dollar in one of those change http://nadav.harel.org.il |machines. Nothing changed. ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]