Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WinSock TCP/IP Client Problem
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00603962
Message ID:
00603969
Views:
23
>>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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform