The scenerio is:
- A server listens on a port number
- If the server is down and the Client tries to connect
- How to set the timeout for the client
Detailed explaination:
In a client server architecture over a TCP/IP, normally the server is started first which waits and listens for the client connection. Here if the client application is started first, it exits saying "Error in connecting to server" i.e it is not able to establish connection with the server application. Now, how to program such that either of the client or server application could be started first. Hint: Some kind of time out is maintained in the client application, sothat it waits for certain time to establish connection with the server.