winsocket2 problem caused lNet onConnect not function properly in WINCE lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- RobinHoo · 2012-11-16 02:18 Hi, All I'm using lNet to develop a network program in WINCE environment. And found the onConnect not function properly. It will report connect successfully even the server not running. And after digging in the source code I found the definition of WINSOCK2_DLL links the wrong dll. The file is located under lazarus\fpc\2.6.0\source\rtl\wince\winsock2.pp. And the original definition is Code: [Select]Const   WINSOCK_VERSION = $0202;   WINSOCK2_DLL = 'ws2_32.dll'; after I revised the definition to Code: [Select]Const   WINSOCK_VERSION = $0202;   {$ifdef WINCE}   WINSOCK2_DLL = 'ws2.dll';   {$else}   WINSOCK2_DLL = 'ws2_32.dll';   {$end} The problem is solved. Share with all of us to avoid any headache in troubleshooting. ---------------------------------------------------------------------- Almindor · 2012-11-18 18:26 This is not a bug. The code in FPC is correct but you should be using rtl/wince/winsock2.pp If you are cross-compiling from win32 to winCE make sure your target is correctly set. The winCE winsock2 version contains the required ifdef. ---------------------------------------------------------------------- RobinHoo · 2012-11-18 23:17 Hi, Almindor Sorry for my slip of the pen. It should be wince target winsocket2.pp file. And I did test it and after revise and before it, the function of onConnect performed differently. ---------------------------------------------------------------------- marcov · 2012-11-19 12:02 Strange, my FPC 2.6.0 reads: Const         WINSOCK_VERSION = $0202; {$IFNDEF WINCE}         WINSOCK2_DLL = 'ws2_32.dll'; {$ELSE WINCE}         WINSOCK2_DLL = 'ws2.dll'; {$ENDIF WINCE}