Hi Anthony
try testing the return of the spcketconnect function, as it seems it's
not working
the help gies an example :
IF SocketConnect("Server", 8000) = False THEN
Error("Connection error" + ErrorInfo(errMessage))
END
Le 6/13/2017 à 9:37 AM, Anthony a écrit :
Hi ,
OK Websockets I get an error, and been trying for couple of days.
I use Windev code from here:
https://doc.pcsoft.fr/en-US/?1000017192Webdev code from here:
https://doc.pcsoft.fr/en-US/?1000017192I see TCP connection established using netstat -n
I trace that socket which exists and it does.
I get this error when I try to socket write:
Error in the browser code:
Vous avez appele la function SocketEcrit.
La Socket de nom client1 n'est pas encore connecte.
The code I use is:
// Global Proc
PROCEDURE SendSocketMessage(sMessage)
IF SocketWrite("client1",sMessage) THEN
Trace("message sent")
ELSE
Trace(SocketError)
END
// Global Proc
PROCEDURE ReceptionMessage(nEvent, sMessage)
gsRes is string = ""
Trace(nEvent)
Trace(sMessage)
SWITCH nEvent
CASE SocketOpening: SocketWrite("client1", "Text of message
sent from the browser.")
Trace("Write to socket")
RETURN
CASE SocketMessage: gsRes += [CR] + "Receiving message: " + sMessage
CASE SocketClosing: gsRes += [CR] + "Closing the socket"
CASE SocketError: gsRes += [CR] + "Error of socket: " + sMessage
RETURN
OTHER CASE
gsRes += [CR] + "other cases: " + sMessage
END
Trace(gsRes)
I have tried this onLoad on a page and I am using it in Browser
declaration, whether its there or Onload on a page same error writing to
the socket
IF SocketExist("client1") = False THEN
SocketConnect("client1", "ws://46.17.216.202:5010/test",
ReceptionMessage,"JSON")
END
Any idea please ....
Thank you !
Tony