Sockets

Sockets[]

returns all active socket connections initiated by your current Wolfram Language session.

Sockets[All]

returns all sockets connected to your current session, including remote sockets originating outside your current session.

Sockets[spec]

returns only sockets specified by spec.

Details

  • Returned sockets are all given as SocketObject constructs.
  • Possible forms of spec include:
  • "Remote"sockets that originate outside the current session
    "Local"sockets that originate within the current session
    "Server"local sockets opened with SocketOpen
    "Client"local sockets connected with SocketConnect
    "TCP"sockets with protocol of "TCP"
    "ZMQ"sockets with protocol of "ZMQ"
    "ZMQ_type"sockets with protocol of "ZMQ_type"
    Allall local and remote sockets
  • Close closes socket connections and frees associated resources.
  • If a socket is opened with SocketOpen and connected to in the same Wolfram Language session with SocketConnect, both sides of the socket will have an associated SocketObject.

Examples

open allclose all

Basic Examples  (2)

Open a socket and show all currently active sockets:

In[1]:=
Click for copyable input
Out[1]=

Close the socket:

In[2]:=
Click for copyable input
Out[2]=

Close all sockets:

In[1]:=
Click for copyable input
Out[1]=

Scope  (2)

Possible Issues  (1)

See Also

SocketOpen  SocketConnect  SocketObject  Close  FindChannels  FindDevices

Introduced in 2017
(11.2)