Player APIs (BrightScript & Ja...
...
Object Reference
Networking Objects
roTCPStream
4min
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 functions docid\ nsjxffr7olfgdwgjfebme 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 docid\ bty uwyk5ty8xkboahbec is posted when the connect attempt succeeds or fails, to the message port set by either setlineeventport() or setbyteeventport()