|
From: L <L...@z5...> - 2007-11-16 22:40:18
|
I wrote:
> Worse case: I will look into the freepascal sockets unit.. and see the source
> code in their Bind() function and maybe see what differences there are.. and
> verify the bind function in sockets.pp even works itself with WSAGetLastError
> and WSAStartup.
program test; {$mode objfpc} {$H+}
uses sockets, winsock2;
var
S : Longint;
SAddr : TInetSockAddr;
procedure perror (const S:string);
begin
writeln ('ERROR: ', S, WsaGetLastError); // right here!!
end;
begin
S:=Socket (AF_INET,SOCK_STREAM,0);
if SocketError<>0 then Perror ('Socket : ');
SAddr.sin_family:=AF_INET;
{ port 80 in network order }
SAddr.sin_port:=htons(80);
SAddr.sin_addr.s_addr:=0;
if not sockets.Bind(S,SAddr,sizeof(saddr)) then
PError ('Bind : ');
// right here!!
end.
...program output...
ERROR: Server : Bind : 10048
(because I have apache open already on port 80)
Whereas synapse reports: zero on fpc, but 10048 on delphi.
So now it is just a matter of comparing it to synapse Windows API calls to see
what differences there are!
L505
|