SocketObject
✖
SocketObject
Details

- Both SocketConnect and SocketOpen give SocketObject[…].
- Functions that operate on socket connections specified by SocketObject include Read, Write, ReadString, WriteString, BinaryRead and BinaryWrite.
- Socket connections are closed using Close.
- SocketConnect creates a socket connection from a source address to a destination address.
- SocketOpen opens a socket at a destination address that accepts connections from source addresses.
- Properties of a socket connection can be found using SocketObject[…][prop] or Options[SocketObject[…],prop]. When applicable, options can be set using SetOptions.
- Properties for all connections include:
-
"SourceIPAddress" the complete source IP address "SourcePort" the source port number (as an integer) "DestinationIPAddress" the complete destination IP address "DestinationPort" the destination port number (as an integer) "Protocol" the connection protocol used ("TCP", "ZMQ", ...) "UUID" the asociated UUID for the socket
Examples
Basic Examples (3)Summary of the most common use cases
Open a connection to a server specified by a URL:

https://wolfram.com/xid/01yloo65o5e-z3hgq8


https://wolfram.com/xid/01yloo65o5e-plb2wr
Read the first line of the response:

https://wolfram.com/xid/01yloo65o5e-fxfxal


https://wolfram.com/xid/01yloo65o5e-drs045


https://wolfram.com/xid/01yloo65o5e-w7szyd

Get the outgoing "SourceIPAddress" on your machine for this socket:

https://wolfram.com/xid/01yloo65o5e-wxl0io


https://wolfram.com/xid/01yloo65o5e-k30i5q

Open a "ZMQ" socket to listen on and connect a client to it:

https://wolfram.com/xid/01yloo65o5e-qqq0nv

The default "Type" for "ZMQ" sockets is "ZMQ_PAIR":

https://wolfram.com/xid/01yloo65o5e-zncyo0


https://wolfram.com/xid/01yloo65o5e-c0uxxw

Wolfram Research (2015), SocketObject, Wolfram Language function, https://reference.wolfram.com/language/ref/SocketObject.html (updated 2017).
Text
Wolfram Research (2015), SocketObject, Wolfram Language function, https://reference.wolfram.com/language/ref/SocketObject.html (updated 2017).
Wolfram Research (2015), SocketObject, Wolfram Language function, https://reference.wolfram.com/language/ref/SocketObject.html (updated 2017).
CMS
Wolfram Language. 2015. "SocketObject." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/SocketObject.html.
Wolfram Language. 2015. "SocketObject." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/SocketObject.html.
APA
Wolfram Language. (2015). SocketObject. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SocketObject.html
Wolfram Language. (2015). SocketObject. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SocketObject.html
BibTeX
@misc{reference.wolfram_2025_socketobject, author="Wolfram Research", title="{SocketObject}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/SocketObject.html}", note=[Accessed: 24-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_socketobject, organization={Wolfram Research}, title={SocketObject}, year={2017}, url={https://reference.wolfram.com/language/ref/SocketObject.html}, note=[Accessed: 24-March-2025
]}