<?xml version="1.0" encoding="UTF-16BE"?>
<credentials>
<id>0</id>
<passwd>assignedpasswd</passwd>
</credentials>
Calling the receive function tells the server to wait for an incoming packet but since the amount of time till the packet arrives is unknown it will instantly return no data. You must call query to get the data received if any. Calling receive, query, and close is identical for both UDP and TCP connections.When you query data it will return the following XML for TCP:
<?xml version="1.0" encoding="UTF-16BE"?>
<packet>
<data>packet contents</data>
</packet>
UDP will return slightly different XML:
<?xml version="1.0" encoding="UTF-16BE"?>
<packet>
<address>127.0.0.1</address>
<port>1234</port>
<data>packet contents</data>
</packet>
I've listed below how each function would be used. Please note that the data parameter containing the message to be sent must have all characters properly escaped. I.e using %20 instead of a space.
Open a TCP socket to the freenode IRC server:
local data = http.get("http://example.com/http2socket.jsp?protocol=tcp&address=irc.freenode.net&port=6667")
Open a UDP socket:
local data = http.get("http://example.com/http2socket.jsp?protocol=udp")
Send a TCP packet:
http.get("http://example.com/http2socket.jsp?action=send&id=0&passwd=assignedpasswd&data=message")
Send a UDP packet:
http.get("http://example.com/http2socket.jsp?action=send&id=0&passwd=assignedpasswd&address=127.0.0.1&port=1234&data=message")
Receive a packet:
http.get("http://example.com/http2socket.jsp?action=receive&id=0&passwd=assignedpasswd")
Query for a received packet:
local data = http.get("http://example.com/http2socket.jsp?action=query&id=0&passwd=assignedpasswd")
Close a socket:
http.get("http://example.com/http2socket.jsp?action=close&id=0&passwd=assignedpasswd")
WAR Download
utf2ascii API: https://bitbucket.org/Scoopta/utf2ascii
Cloud Ninja's lua frontend: http://pastebin.com/m7JNrRa3
The lua wrapper provided by Cloud Ninja has all the documentation required commented out at the top as well as having a copy of the utf2ascii API internally.