Главная страница | назад





Article #27369: Why won't my server socket reconnect?

Question

Why won't my server socket reconnect ?

Answer

The Linux TCP stack has a default wait of 2 minutes before it will let you bind another server socket to that port. This can be circumvented by adding a SetSockOpt() call in the OnCreateHandle event. The actual is as follows.

Var
I : integer;
begin 
SetSockOpt(sock, SOL_SOCKET, SO_REUSEADDR, @I, sizeof(I));
end;

Last Modified: 04-JUN-01