Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WinSock TCP/IP Client Problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00603962
Message ID:
00603969
Vues:
22
>>Hi All
>>
>>I am struggling with a strange problem when trying to set up a TCP/IP Client using the Winsock ActiveX control. Everything works fine if I run the code from the command line, entering ONE line at a time, like this:
>>
>>ox = CREATEOBJECT( "MSWinsock.Winsock.1)
>>ox.RemoteHost = 'acs-server' && Substitute server name
>>ox.RemotePort = 1001  && Substitute as needed
>>ox.Connect()
>>? ox.State  && Returns 7 (Connected)
>>ox.SendData( "Something or other" )
>>ox.Close()
>>RELEASE ox
>>
>
>Hmmm...odd. This works fine for me in a PRG
>
>
>ox = CREATEOBJECT( "MSWinsock.Winsock.1" )
>ox.RemoteHost = 'mail.someserver.com' && E-mail server
>ox.RemotePort = 25  && SMTP
>ox.Connect()
>
<b>>DO WHILE ox.State < 7
>   ? ox.State  && Returns 7 (Connected)
>ENDDO</b>
>
>?ox.State
>
>IF ox.State = 7
>   ?"Connected"
>   ox.SendData( "Something or other" )
>ENDIF
>
>ox.Close()
>RELEASE ox
>
>
>
>
>What type of service are you trying to connect to?

Hi,

The problem in Andy's code code is that it doesn't wait for the connction to be established.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform