SocketWaitNext

SocketWaitNext[{socket1,socket2,}]

waits until there is data ready to read on any of the socketi, then returns that socket.

Details

Examples

Basic Examples  (2)

Connect to a site 5 times and measure how long it takes for the first connection to be ready:

In[1]:=
Click for copyable input

Write a request out on all the sockets and measure how long it takes for at least one of them to get back a request:

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

Close the sockets:

In[3]:=
Click for copyable input

Open a server socket and connect some clients to it:

In[1]:=
Click for copyable input

Initially, none of the clients are ready:

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

Write data to a random client from the server in the local session after a delay:

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

Read the data sent to the client once it has been submitted:

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

See Also

SocketWaitAll  SocketReadyQ  Read  SocketListen  WaitNext

Introduced in 2017
(11.2)