ifSocketAsync

The ifSocketAsync interface provides asynchronous socket features that utilize a full-featured select loop in the Roku OS that communicates to the application using a BrightScript roMessagePort. This interface is valid on roStreamSocket and roDataGramSocket objects that were assigned a BrightScript port via SetMessagePort().

Implemented by

NameDescription
roDataGramSocketThe roDataGramSocket component enables Brightscript apps to send and receive UDP packets
roStreamSocketThe roStreamSocket component enables BrightScript apps to accept and connect to TCP streams as well as send and receive data with them

Supported methods

IsReadable() as Boolean

Description

Checks whether underlying select determines non-blocking read is possible.

Return Value

A flag indicating whether underlying select determines non-blocking read is possible.

IsWritable() as Boolean

Description

Checks whether underlying select determines non-blocking write is possible.

Return Value

A flag indicating whether underlying select determines non-blocking write is possible.

IsException() as Boolean

Description

Checks whether underlying select determines non-blocking read of OOB data is possible.

Return Value

A flag indicating whether underlying select determines non-blocking read of OOB data is possible.

NotifyReadable(enable as Boolean) as Void

Description

Enables roSocketEvent events to be sent via the message port when the underlying socket becomes readable.

Parameters

NameTypeDescription
enableBooleanA flag specifying whether roSocketEvent events are to be sent when the underlying socket becomes readable.

NotifyWritable(enable as Boolean) as Void

Description

Enables roSocketEvent events to be sent via the message port when the underlying socket becomes writable.

Parameters

NameTypeDescription
enableBooleanA flag specifying whether roSocketEvent events are to be sent when the underlying socket becomes writable.

NotifyException(enable as Boolean) as Void

Description

Enables roSocketEvent events to be sent via the message port when the underlying socket gets an exception or OOB data.

Parameters

NameTypeDescription
enableBooleanA flag specifying whether roSocketEvent events are to be sent when the underlying socket gets an exception or OOB data.

GetID() as Integer

Description

Returns a unique identifier that can be compared to the value returned by the roSocketEvent.getSocketID() method to match the underlying socket to receive the event.

Return Paramters

A unique ID.