TCPConnection
From Fernseher
Revision as of 16:57, 20 January 2009 by 129.42.161.36 (talk)
Wrapper for C socket API. Only works for now with IPv4 and TCP streams. Only client support for now as well. Just simpler.
Construct with:
connection = new TCPConnection(remotehost, remoteport)
Exceptions:
TCPConnectionError
Send and receive with:
connection.send(string | array of strings) string = connection.recvAll() string = connection.recvLine(chomp?) array of strings = connection.recvLines(numLines, chomp?) boolean = connection.dataAvailable()
Closure is done when garbage collected, or when close() is called directly:
connection.close()