class PSocket |
A network communications channel.
![]() | Socket establishment functions |
![]() | Socket options functions |
![]() | Port/Service database functions |
![]() | Integer conversion functions |
![]() | Multiple socket selection functions |
![]() | port Port to be used by the socket when opening the channel |
![]() | GetProtocolName () const This function returns the protocol name for the socket type |
Construction
Overrides from class PObject
Information functions
Reading functions
Writing functions
Miscellaneous functions
Error functions
Run Time Type functions
I/O functions
Comparison functions
A network communications channel. This is based on the concepts in the Berkley Sockets library.A socket represents a bidirectional communications channel to a port at a remote host.
Use the SetReadTimeout function to set a maximum time for the Connect
If the port parameter is zero then the port number as defined by the object instance construction or the descendent classes SetPort() or SetService() function.
The port that the socket uses is the one used in the Listen() command of the socket parameter. Note an error occurs if the socket parameter has not had the Listen() function called on it.
Note that this function will block until a remote system connects to the port number specified in the "listening" socket. The time that the function will block is determined by the read timeout of the socket parameter. This will normally be PMaxTimeInterval which indicates an infinite time.
The default behaviour is to assert.
A name is a unique string contained in a system database. The parameter here may be either this unique name, an integer value or both separated by a space (name then integer). In the latter case the integer value is used if the name cannot be found in the database.
The exact behviour of this function is dependent on whether TCP or UDP transport is being used. The PTCPSocket and PUDPSocket classes will implement this function.
The static version of the function is independent of the socket type as its first parameter may be "tcp" or "udp",
A service name is a unique string contained in a system database. The parameter here may be either this unique name, an integer value or both separated by a space (name then integer). In the latter case the integer value is used if the name cannot be found in the database.
The exact behviour of this function is dependent on whether TCP or UDP transport is being used. The PTCPSocket and PUDPSocket classes will implement this function.
The static version of the function is independent of the socket type as its first parameter may be "tcp" or "udp",
A service name is a unique string contained in a system database. The parameter here may be either this unique name, an integer value or both separated by a space (name then integer). In the latter case the integer value is used if the name cannot be found in the database.
The port number may not be changed while the port is open and the function will assert if an attempt is made to do so.
The read, write and except lists are modified by the call so that only the sockets that have data available are present. If the call timed out then all of these lists will be empty.
If no timeout is specified then the call will block until a socket has data available.
Alphabetic index HTML hierarchy of classes or Java