Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using winsock object
Message
De
09/08/2003 16:54:45
 
 
À
09/08/2003 13:43:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00818598
Message ID:
00818621
Vues:
26
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform