# Command: TCPTimeOuts

TCPTimeOuts

Parameters:

read_millis -- timeout if TCP read commands cause no response within specified time (in milliseconds) write_millis -- timeout if TCP write commands cause no response within specified time (in milliseconds) accept_millis -- timeout if TCP accept commands cause no response within specified time (in milliseconds)

Description:

TCPTimeOuts () affects all future calls to the TCP stream functions. You specify the number of milliseconds after which the given timeout should activate; one setting for timeouts when reading from a TCP stream, one for writing to a TCP stream and one for acceptance of a TCP stream (effectively, a server's response time).

Example:

; To cause an error if no connection is received by a server within 3 seconds:
TCPTimeouts 0, 0, 5000 ; 5 second 'accept_millis' parameter
AppTitle "Impatient Server (tm)"
Graphics 640, 480
SetBuffer BackBuffer ()
Text 10, 10, "Accepting incoming data received within 5 seconds..."
Flip
server = CreateTCPServer (8080)
If server
If AcceptTCPStream (server)
Text 10, 30, "Incoming data! Eek!"
Else
Text 10, 50, "Accept timeout activated -- I'm outta here..."
EndIf
CloseTCPServer server
EndIf
Flip
MouseWait
End