[fpc-devel] WinSock error 10106

Ales Katona almindor at gmail.com
Fri Jan 6 11:04:26 CET 2006


Alexander Todorov wrote:

>procedure TTCPClient.Connect;
>begin
>  FSocket := Socket(AF_INET, SOCK_STREAM, 0); // create socket descriptor
>  if (FSocket <= 0) then
>    raise Exception.Create(IntToStr(SocketError));
>.....
>end;
>  
>
It seems like some Winsock1 vs Winsock2 issue to me.
If you use unit "winsock" you're linking to winsock1 (which is old and 
deprecated). Sadly noone in FPC bothered to change it to winsock2. There 
are many winsock2 units out there so you might try to use those and see 
if it happens too.

Windows is full of surprises when it comes to these things. There are 
even "reintroduced" bugs just to keep backwards compatibility because 
they f*cked up.

Honestly tho I never got that error. Btw you might want to try LNet ( 
http://wiki.lazarus.freepascal.org/index.php/LNet ) atleast you can see 
how I do it and prehraps compary my code with your (you're looking to 
TLBaseSocket.SetupSocket).

If you figure this out, can you let me know please? It's always a good 
idea to know possible bugtraps.

Ales



More information about the fpc-devel mailing list