|
@@ -88,7 +88,7 @@ const
|
|
|
SOL_SOCKET = $FFFF;
|
|
|
|
|
|
const
|
|
|
- EsockEINTR = 4; // EsysEINTR;
|
|
|
+ EsockEINTR = 4; // EsysEINTR;
|
|
|
EsockEBADF = 9; // EsysEBADF;
|
|
|
EsockEFAULT = 14; // EsysEFAULT;
|
|
|
EsockEINVAL = 22; //EsysEINVAL;
|
|
@@ -155,18 +155,24 @@ end;
|
|
|
|
|
|
function fpgeterrno: longint; inline;
|
|
|
begin
|
|
|
- fpgeterrno := bsd_Errno;
|
|
|
+ if Assigned(SocketBase) then
|
|
|
+ fpgeterrno := bsd_Errno
|
|
|
+ else
|
|
|
+ fpgeterrno := 0;
|
|
|
end;
|
|
|
|
|
|
function fpClose(d: LongInt): LongInt; inline;
|
|
|
begin
|
|
|
- fpClose := bsd_CloseSocket(d);
|
|
|
+ if Assigned(SocketBase) then
|
|
|
+ fpClose := bsd_CloseSocket(d)
|
|
|
+ else
|
|
|
+ fpClose := -1;
|
|
|
end;
|
|
|
|
|
|
function fpaccept(s: cint; addrx: PSockaddr; Addrlen: PSocklen): cint;
|
|
|
begin
|
|
|
fpaccept := bsd_accept(s,addrx,addrlen);
|
|
|
- internal_socketerror := fpgeterrno;
|
|
|
+ internal_socketerror := fpgeterrno;
|
|
|
end;
|
|
|
|
|
|
function fpbind(s:cint; addrx: psockaddr; addrlen: tsocklen): cint;
|
|
@@ -177,8 +183,16 @@ end;
|
|
|
|
|
|
function fpconnect(s:cint; name: psockaddr; namelen: tsocklen): cint;
|
|
|
begin
|
|
|
- fpconnect := bsd_connect(s, name, namelen);
|
|
|
- internal_socketerror := fpgeterrno;
|
|
|
+ if Assigned(SocketBase) then
|
|
|
+ begin
|
|
|
+ fpconnect := bsd_connect(s, name, namelen);
|
|
|
+ internal_socketerror := fpgeterrno;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ fpconnect := -1;
|
|
|
+ internal_socketerror := ESockEPROTONOSUPPORT;
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
function fpgetpeername (s:cint; name : psockaddr; namelen : psocklen):cint;
|
|
@@ -243,8 +257,16 @@ end;
|
|
|
|
|
|
function fpsocket(domain: cint; xtype: cint; protocol: cint): cint;
|
|
|
begin
|
|
|
- fpsocket := bsd_socket(domain, xtype, protocol);
|
|
|
- internal_socketerror := fpgeterrno;
|
|
|
+ if Assigned(SocketBase) then
|
|
|
+ begin
|
|
|
+ fpsocket := bsd_socket(domain, xtype, protocol);
|
|
|
+ internal_socketerror := fpgeterrno;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ internal_socketerror := ESockEPROTONOSUPPORT;
|
|
|
+ fpsocket := -1;
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
|