When my Application is up first time, I am storing Socket_id of the 3 Server just connecting it.
My Application is itself a server app which listens , recieved data and send to the server which i am connecting to send the data with the Socket_id i have stored.
Now problem is that before sending how can i know that server is disconnected or not available , i mean how can i monitor.
Its a C++ Application.

Thanking in Advance

Recommended Answers

All 3 Replies

What operating system are you using? Also, are you using UDP packets, or TCP streams? TCP streams are simple - you connect a monitoring client to the address:port of the server with a Keep-Alive option, and if the server cannot connect or drops the connection, you will know about it.

Windows as Operating System and TCP Stream, My application act as server and client, client as recieved data to send to other server running.
Previously i used to connect to that multiple server , send data and close the connection.
Now at the start when my application is up first time, that time i am connecting all the server and storing the connection so that i should not connect and close while sending data multiple time.
Problem now is that how can i know that server is not available to me before sending data.
Hope you got my concerned.
Thanking You in Advance

I think the possible way to tell if a server is up or not is to attempt to send some sort of signal like ACK message and wait for limited time to see if you will get a respond from server which could be a signal telling client that its can proceed sending data because its live.

Also if the client is not connected you could detect that by attempting to connect to the server, on error you know the server maybe down or unavailable for whatever reason.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.