Enabled socket options for send and receive timeout at Linux platform.
git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@98 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
parent
2163009542
commit
71b081e456
29
blcksock.pas
29
blcksock.pas
@ -1,5 +1,5 @@
|
|||||||
{==============================================================================|
|
{==============================================================================|
|
||||||
| Project : Ararat Synapse | 009.005.000 |
|
| Project : Ararat Synapse | 009.006.000 |
|
||||||
|==============================================================================|
|
|==============================================================================|
|
||||||
| Content: Library base |
|
| Content: Library base |
|
||||||
|==============================================================================|
|
|==============================================================================|
|
||||||
@ -1508,6 +1508,9 @@ var
|
|||||||
li: TLinger;
|
li: TLinger;
|
||||||
x: integer;
|
x: integer;
|
||||||
buf: TMemory;
|
buf: TMemory;
|
||||||
|
{$IFNDEF WIN32}
|
||||||
|
timeval: TTimeval;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
case value.Option of
|
case value.Option of
|
||||||
SOT_Linger:
|
SOT_Linger:
|
||||||
@ -1552,21 +1555,37 @@ begin
|
|||||||
begin
|
begin
|
||||||
{$IFDEF CIL}
|
{$IFDEF CIL}
|
||||||
buf := System.BitConverter.GetBytes(value.Value);
|
buf := System.BitConverter.GetBytes(value.Value);
|
||||||
{$ELSE}
|
|
||||||
buf := @Value.Value;
|
|
||||||
{$ENDIF}
|
|
||||||
synsock.SetSockOpt(FSocket, integer(SOL_SOCKET), integer(SO_RCVTIMEO),
|
synsock.SetSockOpt(FSocket, integer(SOL_SOCKET), integer(SO_RCVTIMEO),
|
||||||
buf, SizeOf(Value.Value));
|
buf, SizeOf(Value.Value));
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF WIN32}
|
||||||
|
buf := @Value.Value;
|
||||||
|
synsock.SetSockOpt(FSocket, integer(SOL_SOCKET), integer(SO_RCVTIMEO),
|
||||||
|
buf, SizeOf(Value.Value));
|
||||||
|
{$ELSE}
|
||||||
|
timeval.tv_sec:=Value.Value div 1000;
|
||||||
|
timeval.tv_usec:=(Value.Value mod 1000) * 1000;
|
||||||
|
synsock.SetSockOpt(FSocket, integer(SOL_SOCKET), integer(SO_RCVTIMEO),
|
||||||
|
@timeval, SizeOf(timeval));
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
SOT_SendTimeout:
|
SOT_SendTimeout:
|
||||||
begin
|
begin
|
||||||
{$IFDEF CIL}
|
{$IFDEF CIL}
|
||||||
buf := System.BitConverter.GetBytes(value.Value);
|
buf := System.BitConverter.GetBytes(value.Value);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
|
{$IFDEF WIN32}
|
||||||
buf := @Value.Value;
|
buf := @Value.Value;
|
||||||
{$ENDIF}
|
|
||||||
synsock.SetSockOpt(FSocket, integer(SOL_SOCKET), integer(SO_SNDTIMEO),
|
synsock.SetSockOpt(FSocket, integer(SOL_SOCKET), integer(SO_SNDTIMEO),
|
||||||
buf, SizeOf(Value.Value));
|
buf, SizeOf(Value.Value));
|
||||||
|
{$ELSE}
|
||||||
|
timeval.tv_sec:=Value.Value div 1000;
|
||||||
|
timeval.tv_usec:=(Value.Value mod 1000) * 1000;
|
||||||
|
synsock.SetSockOpt(FSocket, integer(SOL_SOCKET), integer(SO_SNDTIMEO),
|
||||||
|
@timeval, SizeOf(timeval));
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
SOT_Reuse:
|
SOT_Reuse:
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user