|
@@ -23,6 +23,7 @@
|
|
|
|
|
|
{$ifdef netwlibc}
|
|
{$ifdef netwlibc}
|
|
{$define notUnix}
|
|
{$define notUnix}
|
|
|
|
+ {$define netware}
|
|
{$endif}
|
|
{$endif}
|
|
|
|
|
|
unit ssockets;
|
|
unit ssockets;
|
|
@@ -125,7 +126,7 @@ type
|
|
Constructor Create(APort: Word);
|
|
Constructor Create(APort: Word);
|
|
Property Port : Word Read FPort;
|
|
Property Port : Word Read FPort;
|
|
end;
|
|
end;
|
|
-
|
|
|
|
|
|
+
|
|
{$ifndef notUnix}
|
|
{$ifndef notUnix}
|
|
TUnixServer = Class(TSocketServer)
|
|
TUnixServer = Class(TSocketServer)
|
|
Private
|
|
Private
|
|
@@ -194,7 +195,7 @@ resourcestring
|
|
strSocketBindFailed = 'Binding of socket failed: %s';
|
|
strSocketBindFailed = 'Binding of socket failed: %s';
|
|
strSocketListenFailed = 'Listening on port #%d failed: %s';
|
|
strSocketListenFailed = 'Listening on port #%d failed: %s';
|
|
strSocketConnectFailed = 'Connect to %s failed.';
|
|
strSocketConnectFailed = 'Connect to %s failed.';
|
|
- strSocketAcceptFailed = 'Could not accept a client connection: %s';
|
|
|
|
|
|
+ strSocketAcceptFailed = 'Could not accept a client connection on socket: %d, error %d';
|
|
strSocketAcceptWouldBlock = 'Accept would block on socket: %d';
|
|
strSocketAcceptWouldBlock = 'Accept would block on socket: %d';
|
|
|
|
|
|
constructor ESocketError.Create(ACode: TSocketErrorType; const MsgArgs: array of const);
|
|
constructor ESocketError.Create(ACode: TSocketErrorType; const MsgArgs: array of const);
|
|
@@ -353,13 +354,15 @@ begin
|
|
end
|
|
end
|
|
except
|
|
except
|
|
On E : ESocketError do
|
|
On E : ESocketError do
|
|
|
|
+ begin
|
|
If E.Code=seAcceptWouldBlock then
|
|
If E.Code=seAcceptWouldBlock then
|
|
begin
|
|
begin
|
|
DoOnIdle;
|
|
DoOnIdle;
|
|
NewSocket:=-1;
|
|
NewSocket:=-1;
|
|
- end;
|
|
|
|
|
|
+ end
|
|
else
|
|
else
|
|
Raise;
|
|
Raise;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
Until (NewSocket>=0) or (Not NonBlocking);
|
|
Until (NewSocket>=0) or (Not NonBlocking);
|
|
Until Not (FAccepting) or ((FMaxConnections<>-1) and (NoConnections>=FMaxConnections));
|
|
Until Not (FAccepting) or ((FMaxConnections<>-1) and (NoConnections>=FMaxConnections));
|
|
@@ -452,7 +455,7 @@ begin
|
|
Raise ESocketError.Create(seAcceptWouldBlock,[socket])
|
|
Raise ESocketError.Create(seAcceptWouldBlock,[socket])
|
|
else
|
|
else
|
|
{$endif}
|
|
{$endif}
|
|
- Raise ESocketError.Create(seAcceptFailed,[socket]);
|
|
|
|
|
|
+ Raise ESocketError.Create(seAcceptFailed,[Socket,SocketError]);
|
|
end;
|
|
end;
|
|
|
|
|
|
{ ---------------------------------------------------------------------
|
|
{ ---------------------------------------------------------------------
|
|
@@ -501,7 +504,7 @@ begin
|
|
If SocketError={$ifdef ver1_0}Sys_EWOULDBLOCK{$else}ESysEWOULDBLOCK{$endif} then
|
|
If SocketError={$ifdef ver1_0}Sys_EWOULDBLOCK{$else}ESysEWOULDBLOCK{$endif} then
|
|
Raise ESocketError.Create(seAcceptWouldBlock,[socket])
|
|
Raise ESocketError.Create(seAcceptWouldBlock,[socket])
|
|
else
|
|
else
|
|
- Raise ESocketError.Create(seAcceptFailed,[socket]);
|
|
|
|
|
|
+ Raise ESocketError.Create(seAcceptFailed,[socket,SocketError]);
|
|
end;
|
|
end;
|
|
|
|
|
|
Function TUnixServer.SockToStream (ASocket : Longint) : TSocketStream;
|
|
Function TUnixServer.SockToStream (ASocket : Longint) : TSocketStream;
|
|
@@ -549,10 +552,10 @@ begin
|
|
try
|
|
try
|
|
If Not NameLookup(FHost) then
|
|
If Not NameLookup(FHost) then
|
|
raise ESocketError.Create(seHostNotFound, [FHost]);
|
|
raise ESocketError.Create(seHostNotFound, [FHost]);
|
|
- A:=HostAddress;
|
|
|
|
|
|
+ A:=HostAddress;
|
|
finally
|
|
finally
|
|
free;
|
|
free;
|
|
- end;
|
|
|
|
|
|
+ end;
|
|
addr.family := AF_INET;
|
|
addr.family := AF_INET;
|
|
addr.port := ShortHostToNet(FPort);
|
|
addr.port := ShortHostToNet(FPort);
|
|
addr.addr := Cardinal(A);
|
|
addr.addr := Cardinal(A);
|
|
@@ -597,7 +600,11 @@ end.
|
|
|
|
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.22 2004-09-17 19:03:32 armin
|
|
|
|
|
|
+ Revision 1.23 2004-09-18 23:24:12 armin
|
|
|
|
+ + netwlibc support
|
|
|
|
+ * added error number to seAcceptFailed exception
|
|
|
|
+
|
|
|
|
+ Revision 1.22 2004/09/17 19:03:32 armin
|
|
* added ssockets for target netwlibc
|
|
* added ssockets for target netwlibc
|
|
|
|
|
|
Revision 1.21 2003/11/22 11:51:28 sg
|
|
Revision 1.21 2003/11/22 11:51:28 sg
|