Unix Network Programming

I have written a client-server program which does some data from a file in server to the client. In this I don't want the client to wait indefinitely if server is not running. For this I am using SELECT system call, in this system call we can specify timings as an argument, which tells the client to waits for the server to send the data within that time. Now the problem is, it's sending the data oly for that no. of seconds(as specified in select() ). It's not doing the actual work..
NOTE:- I am using UDP connection.

Can Anyone solve this problem??

Your client should select the socket for read events.

  • as soon as the answer from the server is received, select shall return and you may further process, or
  • select shall block until the timeout expires. In this case, you may conclude that the server is possibly not running, and terminate the processing.

Since you're using UDP, you may also want to connect to the server using connect(). On some systems, you'll get possible error (like ICMP "port unreachable"), though asynchronously.

HTH, Lo�c

Ya I got it. Thanks Pal..