[fpc-pascal] Re: WSAGetLastError returns 0 when it shouldn't but I cannot see why

Luca Olivetti luca at ventoso.org
Wed Feb 27 21:46:31 CET 2008

El Wed, 27 Feb 2008 12:04:22 -0700
L <L at z505.com> escribió:

>  > While using synapse in a thread, I saw that it didn't report an
>  > error 
> on connection,
>  > eventually I saw that the call to WSAGetLastError was returning 0 
> even if it couldn't
>  > connect and the connect call returned an error.
> I am also working on this issue still.
> I had the WSAGetLastError working using direct sockets.pp calls but 
> didn't get it working using synapse yet.. but I didn't try very hard
> and that is one of my tasks this week. I think there is something in
> synapse possibly which still may be causing the issue, such as maybe 
> wsagetlasterror not being stored in a temporary variable.. but I
> think it is and will have to cheeck (i.e. maybe similar to the
> writeln issue where writeln doesn't store it in tmp var first).

I don't think that synapse is to blame[*]: my test
program is also using the sockets unit directly, and stores SocketError
(which just calls WSAGetLastError) in a variable.
What really puzzles me is that project3 (your test program modified to
use tthread and to do a connect instead of a bind) works while project2
doesn't. Maybe I've been staring at them for too long, but I cannot see
the difference.

[*]apart that you can only know that a socket operation was
successful by checking LastError.


More information about the fpc-pascal mailing list