- Jonathan Edwards
Socket
Socket Methods
Derived Classes
See Also
Class Hierarchy, SocketStream, SocketEvent
public method Socket(int PortNumber = 0)
Parameters
PortNumber
Port number (0 for client and non-zero for server)
Return Value
None
Description
Constructor for the abstract Socket class. The port number is passed in, though for ClientSocket objects, the port number is zero at creation and it is specified during the Connect() process. Once the Connect operation is complete, the internal port number value is set to that port number. For ServerSocket objects,it must be a valid port number, and it is the port that's used to listen for incoming requests.
Socket Class
public method<bool> IsValid()
Parameters
None
Return Value
True if the socket is valid
Description
This method returns true if the underlying system socket is valid and false if not. As long as sockets are properly setup at the operating system level on the computer, this valid flag should be true. No socket I/O operations will be allowed with this object if the underlying system socket is not valid.
Socket Class
public method<int> Port()
Parameters
None
Return Value
Returns the associated port number
Description
Returns the port number associated with this socet. If it's a server socket, the port number is specified during creation, and won't change during the lifetime of the socket object. If it's a client socket, the port number is zero at startup and is set after a successful Connect() call.
Socket Class
public abstract method Close()
Parameters
None
Return Value
None
Description
This abstract method closes the socket. Each derived class must override this method and handle the closing of the socket appropriately.
Socket Class