** form.init method ACTIVATE SCREEN CLEAR ON SHUTDOWN QUIT SET TALK OFF SET ECHO OFF with ThisForm .OleControl1.LocalAddress = "194.106.108.233" &&& your ip .OleControl1.LocalPort = 0 .OleControl1.Create() .OleControl1.RemoteNameAddrXlate = .T. .OleControl1.RemoteName = "pepe.online.ee" .OleControl1.RemotePort = 7 .OleControl1.Blocking = .F. .OleControl1.ConnectTimeout = 5 .OleControl1.object.Connect() endwith DO WHILE THIS.olecontrol1.state!=4 IF INKEY(0.5)=27 RETURN .F. ENDIF ? 'Connecting', THIS.olecontrol1.lasterrorstring ENDDO cBuffer = REPLICATE( CHR(0), 100 ) DO WHILE INKEY(.5)!=27 and THIS.olecontrol1.state=4 THIS.olecontrol1.send( CREATEBINARY(m.cBuffer) ) CStr = '' * ?????????????????????????????????????????????????? * The following loop will run infinitely. Why ? DO WHILE INKEY(.5)!=27 and THIS.olecontrol1.state=4 AND EMPTY(cStr) THIS.olecontrol1.receive(1) cStr = this.olecontrol1.receivebuffer ? THIS.olecontrol1.lasterrorstring ENDDO ?'Received', len(cStr), cStr IF cStr!=m.cBuffer ?? 'Error' ELSE ?? 'OK' ENDIF ENDDO RETURN .F.>Your code doesn't seem to connect the right way. If your Socket/X control's name is olecontrol1, your should start by doing something like this to connec:
>with ThisForm > .OleControl1.LocalAddress = "192.168.1.1" &&& your ip > .OleControl1.LocalPort = 0 > .OleControl1.Create() > *** if you connect by ip address, you should do then > .OleControl1.RemoteNameAddrXlate = .F. > .OleControl1.RemoteAddress = "212.155.99.148" &&& other side's ip > *** otherwise if you connect by name > .OleControl1.RemoteNameAddrXlate = .T. > .OleControl1.RemoteName = "www.eetasoft.ee" > > .OleControl1.RemotePort = 7 > .OleControl1.Blocking = .F. > *** now set a connection timeout, let's say 5 seconds > .OleControl1.ConnectTimeout = 5 > > *** finally connect... > .OleControl1.object.Connect() >endwith >>Now, if you check ThisForm.OleControl1.State, it should really be 4 and then you can go on with the data transmissions.