Helo,

If tcp connection with server is lost, should program close current socket with close(socket_fd) and then use connect(....) again, or use same socket to reconnect with connect(....)? Or when connection is lost current socket is destroyed automatically?

Well it rather depends on the application.

Web browsers for example just give up and print a message.

A file downloader might retry.

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.