Recent

Author Topic: winsocket2 problem caused lNet onConnect not function properly in WINCE  (Read 4325 times)

RobinHoo

  • New Member
  • *
  • Posts: 10
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.
« Last Edit: November 19, 2012, 12:14:39 am by RobinHoo »

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
Re: winsocket2 problem caused lNet onConnect not function properly in WINCE
« Reply #1 on: November 18, 2012, 07:26:29 pm »
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

  • New Member
  • *
  • Posts: 10
Re: winsocket2 problem caused lNet onConnect not function properly in WINCE
« Reply #2 on: November 19, 2012, 12:17:10 am »
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

  • Administrator
  • Hero Member
  • *
  • Posts: 11446
  • FPC developer.
Re: winsocket2 problem caused lNet onConnect not function properly in WINCE
« Reply #3 on: November 19, 2012, 01:02:33 pm »
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}


 

TinyPortal © 2005-2018