Why won't my server socket reconnect?

By: Mat Duafala

Abstract: Server Socket Connections not working.
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;


Server Response from: BDN10A

 
© Copyright 2008 Embarcadero Technologies, Inc. All Rights Reserved. Contact Us   Site Map   Legal Notices   Privacy Policy   Report Software Piracy