Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using winsock object
Message
From
09/08/2003 16:54:45
 
 
To
09/08/2003 13:43:00
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00818598
Message ID:
00818621
Views:
25
i have defined a class in myprog.prg like this.

DEFINE CLASS frmSock AS OleControl
OleClass = "MSWinsock.Winsock"
...
ENDPROC


Try defining your class like this instead:
DEFINE CLASS TCPClient AS CUSTOM
  cServer  = LOWER( LEFT( SYS(0), AT( "#", SYS(0)  ) - 1 ) ) && Local machine name
  nRemPort = 1001 && Default port to use
  oConnect = NULL
  
  FUNCTION Init( tcServer, tnRemPort )
  LOCAL lcServer, lnRemPort
    WITH This
      *** Default to local machine name if nothing specified
      .cServer = IIF( EMPTY( tcServer ), .cServer, tcServer )
      *** Remote Port ID defaults to 1001
      .nRemPort = IIF( EMPTY( tnRemPort ), .nRemPort, tnRemPort )
      *** Create the Connection object
      .oConnect = CREATEOBJECT( "MSWinsock.WinSock" )
    ENDWITH
  ENDFUNC
ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform