function ForceCloseSocket(DestSock:TSocket):Boolean; var NoWait:Boolean; NLinger:Tlinger; begin Result:=False; NoWait:=False; if SetSockOpt(DestSock,SOL_SOCKET,SO_DONTLINGER,@NoWait,sizeOf(Boolean))=SOCKET_ERROR then Result:=False; NLinger.l_onoff:=1; NLinger.l_linger:=0; if SetSockOpt(DestSock,SOL_SOCKET,SO_LINGER,@NLinger,sizeOf(NLinger))=SOCKET_ERROR then Result:=False else Result:=True; if CloseSocket(DestSock)=SOCKET_ERROR then Result:=Flase else Result:=True; end;