Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TCP Connections / Talking to EventGhost
#7
In this case Receive() hangs if not specified size of data to receive, or specified more.

This code works.

Macro Macro1568
Code:
Copy      Help
out
#compile "__TcpIpClient"
TcpIpClient x

str server="localhost"
str password="xxxxxxxx"
str request="test_qm"

str receivedData
str cookie
str digest

out "---- connecting ----"

if(!x.Connect(server 1024)) end "failed"

out "---- validating ----"

if(!x.Send("quintessence[10]")) end "failed"
if(!x.Receive(cookie 5)) end "failed"
cookie.trim; cookie+":"; cookie+password
out cookie
digest.encrypt(2|8 cookie)
out digest
digest+"[10]"
if(!x.Send(digest)) end "failed"
if(!x.Receive(receivedData 7)) end "failed"
out receivedData

out "---- sending request ----"

if(!x.Send("payload withoutRelease[10]")) end "failed"
if(!x.Send(_s.from(request "[10]"))) end "failed"

out "---- sent ----"

x.Send("close[10]")

Also I updated TcpIpClient.Receive. Now it is more reliable. This code works with the old version too.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)