> dear experts
>
> happy new year
>
>
> I want to receive data from telephone exchange using winsock control.. Exchange has an IP ie 192.168.1.50, Port 5100, I'd gone thru the detail & downloaded a small program of winsock, but not able to receive it... It works fine with Windows Hyper Terminal
>
> tcpserver is name of winsock control
> txtoutput is name of textbox in which i want to show data
>
> form Init Event
> --------------
> ThisForm.tcpServer.Object.LocalPort = 1001
> ThisForm.tcpServer.Object.Listen
>
>
> **************Winsock_DataArrival Event
> *** ActiveX Control Event ***
> LPARAMETERS bytestotal
>
> strData = SPACE(256) && Define string to pass to GetData
>
> This.Object.GetData(@strData)
> ThisForm.txtOutput.Value = strData
>
> *************winsock Connectionrequest Event
> *** ActiveX Control Event ***
> LPARAMETERS requestid
> #DEFINE sckClosed 0
> If This.Object.State <> sckClosed
> This.Object.Close
> ENDif
> *!* Accept the request with the requestID
> *!* parameter.
> This.Object.Accept(requestID)
>
> Kindly help
>
>
> kumardheeraj
Hello,
I have done some basic w3ork with winsock and think that if you make the following additions you should be able to communicate.
In the init you need to set the remote host and port
thisform.tcpserver.object.remotehost = "192.168.1.50"
thisform.tcpserver.object.remoteport = 5100
you then need to connect to the remote host.
thisform.tcpserver.object.connect()
you can then test to see if you have connected, maybe via a button on your form
lnConnectionStatus = thisform.tcpserver.object.state
*!* 0 sckClosed connection closed
*!* 1 sckOpen open
*!* 2 sckListening listening for incoming connections
*!* 3 sckConnectionPending connection pending
*!* 4 sckResolvingHost resolving remote host name
*!* 5 sckHostResolved remote host name successfully resolved
*!* 6 sckConnecting connecting to remote host
*!* 7 sckConnected connected to remote host
*!* 8 sckClosing connection is closing
*!* 9 sckError error occured
Regards
Richard