SocketWaitAll[{socket1,socket2,…}]
waits until there is data ready to read on all of the socketi.
SocketWaitAll
SocketWaitAll[{socket1,socket2,…}]
waits until there is data ready to read on all of the socketi.
Details
- The socketi are specified as SocketObject[…].
- SocketWaitAll[{socket1,socket2,…}] returns {socket1,socket2,…}.
- SocketWaitAll does not support web sockets.
Examples
open all close allBasic Examples (2)
Connect to a site 5 times and measure how long it takes for all connections to be ready:
clients = Table[SocketConnect["http://exampledata.wolfram.com"], 5];Write a request out on all the sockets and measure how long it takes for all of them to get back a request:
WriteString[#, "GET /50states.txt HTTP/1.1
"]& /@ clients;
First@AbsoluteTiming[SocketWaitAll[clients]]Close /@ clients;Open a server socket and connect some clients to it:
server = SocketOpen[Automatic];
clients = Table[SocketConnect[server], 5];Initially, none of the clients are ready:
SocketReadyQ /@ clientsWrite data to each of the clients from the server in the local session after a delay:
SessionSubmit[ScheduledTask[WriteString[#, DateString[]], {5}]]& /@ server["ConnectedClients"];Read the data sent to the clients once it has been submitted:
AbsoluteTiming[SocketWaitAll[clients];ByteArrayToString /@ SocketReadMessage /@ clients]Possible Issues (1)
SocketWaitAll does not support web sockets:
socket = SocketConnect["wss://echo.websocket.org"];
SocketWaitAll[{socket}]See Also
Related Guides
History
Text
Wolfram Research (2017), SocketWaitAll, Wolfram Language function, https://reference.wolfram.com/language/ref/SocketWaitAll.html.
CMS
Wolfram Language. 2017. "SocketWaitAll." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SocketWaitAll.html.
APA
Wolfram Language. (2017). SocketWaitAll. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SocketWaitAll.html
BibTeX
@misc{reference.wolfram_2026_socketwaitall, author="Wolfram Research", title="{SocketWaitAll}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/SocketWaitAll.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_socketwaitall, organization={Wolfram Research}, title={SocketWaitAll}, year={2017}, url={https://reference.wolfram.com/language/ref/SocketWaitAll.html}, note=[Accessed: 13-June-2026]}