Programming Sockets to Reconnect

Hello everyone,

I'm very interested in sockets programming
for developing games.

Right now i'm trying to develop a client,
and connecting to a host and port can be done,
but i googled lots of pages,
but i could not find how to reconnect
to the host/port if the connection is somehow
broken.

Is there a way to do that?
Pardon me if i sound new, i am new...

that depends on what protocol you use, for one thing. i guess tcp/ip. so if you have a connection loss, ie pull cable and put back in, the connection will remain as long as you dont quit it or some system specific timeout applies. if you want a "soft" reconnect, meaning the connection was lost, and a client directly starts a new connection, you have to have some way to identify that new connection as the clients one, and replace the clients old stale connection with the new one.

The idea with TCP/IP is that you don't. Once the stream is broken it is dead, no more. A new stream/connection needs to be made.

UDP/IP does not uses connections and is often used for games.