Hi,
I'm trying to connect to a windows socket & although my test routine is working, I dont seem to be able to check if i'm connected.
I have a public variable called lConnected that is initially set to .F. - this is set to true in bConnect, but when i try to reference it, it always returns .f. - the senddata & getdata routines all work fine.
Is there a better way to detect if i'm connected?
Thanks in advance
Pete
I'm trying to connect to a windows socket & although my test routine is working, I dont seem to be able to check if i'm connected.
I have a public variable called lConnected that is initially set to .F. - this is set to true in bConnect, but when i try to reference it, it always returns .f. - the senddata & getdata routines all work fine.
Is there a better way to detect if i'm connected?
STATIC FUNCTION SocketTest
  LOCAL mTimer  := 0
  PRIVATE oSocket  := TSocket():New(8888)
  oSocket:bRead := { | oSocket | Msginfo( oSocket:GetData() )  }
 Â
  oSocket:bConnect := { || lConnected := .T. }
  oSocket:Connect( "192.168.69.92" ) // use the server IP address here
 Â
  DO WHILE !lConnected .AND. mTimer < 999999
    mTimer++
  ENDDO
 Â
  IF lConnected
    oSocket:SendData( "Hello" )
 Â
    ThreadSleep(1000)
    IF MsgYesNo("Quit?")
      RETU NIL
    ENDIF
  ELSE
    ? "Not Connected"
  ENDIF
RETURN NILThanks in advance
Pete