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

Luca Olivetti luca at ventoso.org
Wed Feb 27 09:40:19 CET 2008


Hello, before reporting a bug, I'm asking for support here since I'm not 
sure I doing something wrong (and if so what am I doing wrong).

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 found bug 10205 (http://bugs.freepascal.org/view.php?id=10205) but in 
my case there is no direct writeln in sight (side note: why isn't it 
possible to add a note to a closed bug?).

Oddly enough, a slightly modified threadwsagetlast (attached as 
project3.lpr) from the one in the bug report works as expected, while my 
thread (now using directly the sockets unit, not wrapped by synapse) 
still reports 0.

The attached project2.lpr has a connection to a non existent host/port 
in a thread and outside the thread, and it both cases it reports 0 
(UseSynchronize true or false doesn't make a difference), and while 
reduced to the minimum it has the same structure of the thread I'm 
actually going to use.
project3.lpr is adapted from the bug report and correctly reports 10060 
(connection timed out), but I cannot really see the difference between 
one and the other (besides the fact that mine uses methods and the other 
uses procedures defined outside the class, but that shouldn't really 
matter, should it?)
Note that project3 uses deprecated sockets procedures, while mine uses 
the "correc" fp prefixed ones, but I tried with the deprecated ones 
before with the same result.

This is under windows with fpc 2.2.0 (coming from a lazarus snapshot), 
the original problem with synapse was with a lazarus snapshot with 2.2.1 
(hence I went back to 2.2.0 to see if it was a regression in 2.2.1).

Bye
-- 
Luca

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: project2.lpr
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20080227/026d3da7/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: project3.lpr
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20080227/026d3da7/attachment-0001.ksh>


More information about the fpc-pascal mailing list