Socket reset

My application connects as a client via ethernet to the server process.

Since the server is well known and will not change, UDP and TCP are set using

socket(); 
setsockopt(SO_REUSEADDR);
bind(); 
connect();

The connection protocol includes bits sent in both directions.

When I find a connection error, for example. hearbeat timeout, I need to reset the connection.

Is it enough to just connect () to a NULL address and then reconnect () after a short pause or close the box and then reinitialize from scratch?

thank

+3
source share
2 answers

You need a close(2)socket and try again. Why are you bind(2)on the client?

+1
source

.

Winsock, :

, . , .

+2

Source: https://habr.com/ru/post/1776505/


All Articles