roTCPStream
Â
The JavaScript equivalent is net.socket.
ifStreamReceive
SetLineEventPort(messagePort As Object)
Sets the message port that roStreamLineEvent events will be posted to.
SetByteEventPort(messagePort As Object)
Sets the message port that roStreamByteEvent events will be posted to.
SetByteArrayEventPort(messagePort As Object)
This method works like SetByteEventPort but causes roStreamByteArrayEvent messages to be posted to the message port when data is received. For some object types (for example, roTCPStream), this can be much more efficient since data no longer needs to be delivered to BrightScript a byte at a time.
SetReceiveEol(messagePort As String or roByteArray)
Sets the sequence that will signify the end of line and cause a roStreamLineEvent to be delivered to the message port set by SetLineEventPort. If you need to set this value to a non-printing character, use the chr()
 global function or an roByteArray. If the sequence contains NUL bytes it must be passed as an roByteArray since strings may not contain NUL bytes.
To use a NUL byte as a line terminator:
eol = CreateObject("roByteArray")
eol.Push(0)
mp = CreateObject("roMessagePort")
client = CreateObject("roTCPStream")
client.SetReceiveEol(eol)
client.SetLineEventPort(mp)
SetMatcher(matcher As Object) As Boolean
Instructs the stream to use the specified matcher. This object returns True
if successful. Pass Invalid
to this method to stop using the specified matcher.
ifUserData
SetUserData(user_data As Object)
Sets the user data that will be returned when events are raised.
GetUserData() As Object
Returns the user data that has previously been set via SetUserData(). It will return Invalid
if no data has been set.
ifStreamSend
SetSendEol(eol_sequence As String) As Void
Sets the EOL sequence when writing to the stream. The default value is CR (ASCII value 13). If you need to set this value to a non-printing character, use the chr()
 global function.
SendByte(byte As Integer) As Void
Writes the specified byte to the stream.
SendLine(string As String) As Void
Writes the specified characters to the stream followed by the current EOL sequence.
SendBlock(a As Dynamic) As Void
Writes the specified characters to the stream. This method can support either a string or an roByteArray. If the block is a string, any null bytes will terminate the block.
Flush()
ifTCPStream
GetFailureReason() As String
Yields additional useful information if an roTCPStream method fails.
ConnectTo(a As String, b As Integer) As Boolean
Connects the stream to the specified host (designated using a dotted quad) and port. The function returns True
upon success.
Accept(a As Object) As Boolean
Accepts an incoming connection event. The function returns True
upon success.
AsyncConnectTo(a As String, b As Integer) As Boolean
Attempts to connect the stream to the specified host (designated using a dotted quad) and port. The function returns False
 if this action is immediately impossible (for example, when the specified host is not in the correct format). Otherwise, the function returns True
 upon success. The connect proceeds in the background, and an roStreamConnectResultEvent is posted when the connect attempt succeeds or fails, to the message port set by either SetLineEventPort()
 or  SetByteEventPort()
.
Â
Â