Object

ServerSocket Class

Used to support multiple connections on the same port. The ServerSocket is available only in the Professional version of REALbasic.

Events
AddSocket
Error

Properties
Handle
IsListening
LocalAddress
MaximumSocketsConnected
MinimumSocketsAvailable
Port

Methods
ActiveConnections
Listen
StopListening

# Notes

A ServerSocket is a permanent socket that listens on a single port for multiple connections. When a connection attempt is made on that port, the ServerSocket hands the connection off to another socket, and continues listening on the same port. Without the ServerSocket, it is difficult to implement this functionality due to the latency between a connection coming in, being handed off, creating a new listening socket, and restarting the listening process. If you had two connections coming in at about the same time, one of the connections may be dropped because there was no listening socket available on that port.

You can change the MinimumSocketsAvailable and MaximumSocketsConnected properties after establishing the listening socket. If you change the MaximumSocketsConnected property, it will not kill any existing connections (it just may not allow more connections until the existing connections have been released). If you change the MinimumSocketsAvailable property, it may fire the AddSocket event to replenish its internal buffer.

Binding a ServerSocket to a port below 1024 requires the proper privileges on all operating systems.

The ServerSocket and SSLSocket are available only in the Professional version of REALbasic.

# See Also

SocketCore, SSLSocket, TCPSocket classes.