tests if there is any data immediately available to read from the specified socket.


waits for up to t seconds to see if data becomes available to read.


  • Sockets in SocketReadyQ[] are specified using SocketObject[].
  • SocketReadyQ returns immediately; unlike Read etc., it does not block waiting for data to become available.
  • For numeric values, t is interpreted as having units of seconds. A time Quantity can also be used.


open allclose all

Basic Examples  (3)

Initially on connection, most websites will not send data until a request is made:

Write a request to the socket and wait for up to 10 seconds for the server's response to arrive:

Close the socket:

Open a server socket and connect a client socket to it:

Initially, neither of them has any data available:

Sending a message to the client makes the socket ready for reading:

After reading the message, there is no more data available:

Close the sockets:

Wait for a response using a Quantity as the second argument:

Close the socket:

Neat Examples  (1)

Make a simple ping time function, measuring how long it takes for an HTTP response to come back:

Ping a host to see how long before it responds:

Request the page multiple times:

Wolfram Research (2017), SocketReadyQ, Wolfram Language function,


Wolfram Research (2017), SocketReadyQ, Wolfram Language function,


Wolfram Language. 2017. "SocketReadyQ." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2017). SocketReadyQ. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_socketreadyq, author="Wolfram Research", title="{SocketReadyQ}", year="2017", howpublished="\url{}", note=[Accessed: 13-July-2024 ]}


@online{reference.wolfram_2024_socketreadyq, organization={Wolfram Research}, title={SocketReadyQ}, year={2017}, url={}, note=[Accessed: 13-July-2024 ]}