SocketListener
represents a socket listener created by SocketListen.
Details
- The socket listener can be removed with DeleteObject.
- Properties of the socket listener can be modified with SocketListener[…][prop]=val.
- The property "Socket" returns the SocketObject being listened on by this SocketListener.
- The following properties can be modified on the SocketListener:
-
CharacterEncoding $CharacterEncoding the character encoding to assume HandlerFunctionsKeys Default keys to include in the data association HandlerFunctions Automatic how to handle socket events RecordSeparators None how messages are taken to be delimited - The following events can be generated while listening on the socket:
-
"DataReceived" data is available on the socket - The following default keys are included in the association for each generated event:
-
"Data" the data received, as a string "Socket" the SocketObject being listened on "SourceSocket" the SocketObject that generated the event "Timestamp" time when the event occurred (as a DateObject) - The following additional keys can also be requested in HandlerFunctionsKeys:
-
"DataBytes" the raw data received, as a list of byte values "DataByteArray" the raw data received, as a ByteArray object "MultipartComplete" whether a multipart ZMQ message is complete
Examples
Basic Examples (3)
Listen on an available socket to get a SocketListener:
Get the options for the listener:
Stop listening and close the socket:
Listen on an available socket:
Change the value of the HandlerFunctionsKeys after starting listening on the socket:
Stop listening and close the socket automatically opened for this listener:
Listen on an available socket and get the underlying socket that was opened to connect to it:
Get the SocketObject that was automatically opened:
Text
Wolfram Research (2017), SocketListener, Wolfram Language function, https://reference.wolfram.com/language/ref/SocketListener.html.
CMS
Wolfram Language. 2017. "SocketListener." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SocketListener.html.
APA
Wolfram Language. (2017). SocketListener. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SocketListener.html