Difference between revisions of "TCPConnection"
From Fernseher
Jump to navigationJump to search
(New page: 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, r...) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
Wrapper for C socket API. Only works for now with IPv4 and TCP streams. Only client support for now as well. Just simpler. | Wrapper for C socket API. Only works for now with IPv4 and TCP streams. Only client support for now as well. Just simpler. Why would a user of [[Modjs]] need server support anyway? | ||
Construct with: | Construct with: | ||
Line 11: | Line 11: | ||
string = connection.recvAll() | string = connection.recvAll() | ||
string = connection.recvLine(chomp?) | string = connection.recvLine(chomp?) | ||
array of strings = connection. | array of strings = connection.recvLines(numLines, chomp?) | ||
boolean = connection.dataAvailable() | boolean = connection.dataAvailable() | ||
Closure is done when garbage collected, or when close() is called directly: | Closure is done when garbage collected, or when close() is called directly: | ||
connection.close() | connection.close() |
Latest revision as of 16:46, 21 January 2009
Wrapper for C socket API. Only works for now with IPv4 and TCP streams. Only client support for now as well. Just simpler. Why would a user of Modjs need server support anyway?
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()