class PIPSocket: public PSocket

This class describes a type of socket that will communicate using the Internet Protocol

Inheritance:


Public Classes

[more]class Address : public in_addr
A class describing an IP address
[more]class RouteEntry : public PObject
Describes a route table entry
[more]class InterfaceEntry : public PObject
Describes an interface table entry

Public Methods

[more]virtual PString GetName () const
Get the platform and I/O channel type name of the channel.
[more]virtual BOOL Connect ( const PString & address )
Connect a socket to a remote host on the specified port number.
[more]virtual BOOL Listen ( unsigned queueSize = 5, WORD port = 0, Reusability reuse = AddressIsExclusive )
Listen on a socket for a remote host on the specified port number.
[more]static PString GetHostName ()
Get the öfficial" host name for the host specified or if none, the host this process is running on.
[more]static BOOL GetHostAddress ( Address & addr )
Get the Internet Protocol address for the specified host, or if none specified, for the host this process is running on.
[more]static PStringArray GetHostAliases ( const PString & hostname )
Get the alias host names for the specified host.
[more]static BOOL IsLocalHost ( const PString & hostname )
Determine if the specified host is actually the local machine.
[more]virtual BOOL GetLocalAddress ( Address & addr )
Get the Internet Protocol address for the local host.
[more]virtual BOOL GetPeerAddress ( Address & addr )
Get the Internet Protocol address for the peer host the socket is connected to.
[more]PString GetLocalHostName ()
Get the host name for the local host.
[more]PString GetPeerHostName ()
Get the host name for the peer host the socket is connected to.
[more]static void ClearNameCache ()
Clear the name (DNS) cache
[more]static BOOL GetGatewayAddress ( Address & addr )
Get the IP address that is being used as the gateway, that is, the computer that packets on the default route will be sent.
[more]static PString GetGatewayInterface ()
Get the name for the interface that is being used as the gateway, that is, the interface that packets on the default route will be sent.
[more]static BOOL GetRouteTable ( RouteTable & table )
Get the systems route table.
[more]static BOOL GetInterfaceTable ( InterfaceTable & table )
Get a list of all interfaces


Inherited from PSocket:

Public

Socket establishment functions

Socket options functions

Port/Service database functions

Multiple socket selection functions

Integer conversion functions

Protected Fields

oWORD port

Protected Methods

ovirtual const char* GetProtocolName() const


Inherited from PChannel:

Public Methods

ostatic BOOL ConvertOSError( int libcReturnValue, Errors & lastError, int & osError )

Public

Construction

Overrides from class PObject

Information functions

Reading functions

Writing functions

Miscellaneous functions

Error functions

Protected Fields

oint os_handle
oErrors lastErrorCode[NumErrorGroups+1]
oint lastErrorNumber[NumErrorGroups+1]
oPINDEX lastReadCount
oPINDEX lastWriteCount
oPTimeInterval readTimeout
oPTimeInterval writeTimeout

Protected Methods

ovirtual BOOL ConvertOSError( int libcReturnValue, ErrorGroup group = LastGeneralError )
oBOOL SetErrorValues( Errors errorCode, int osError, ErrorGroup group = LastGeneralError )
oint ReadCharWithTimeout( PTimeInterval & timeout )


Inherited from PObject:

Public

Run Time Type functions

Comparison functions

I/O functions


Documentation

This class describes a type of socket that will communicate using the Internet Protocol
ovirtual PString GetName() const
Get the platform and I/O channel type name of the channel. For an IP socket this returns the host name of the peer the socket is connected to, followed by the socket number it is connected to.

Returns:
the name of the channel.

ovirtual BOOL Connect( const PString & address )
Connect a socket to a remote host on the specified port number. This is typically used by the client or initiator of a communications channel. This connects to a "listening" socket at the other end of the communications channel.

The port number as defined by the object instance construction or the PIPSocket::SetPort() function.

Returns:
TRUE if the channel was successfully connected to the remote host.
Parameters:
address - Address of remote machine to connect to.

ovirtual BOOL Listen( unsigned queueSize = 5, WORD port = 0, Reusability reuse = AddressIsExclusive )
Listen on a socket for a remote host on the specified port number. This may be used for server based applications. A "connecting" socket begins a connection by initiating a connection to this socket. An active socket of this type is then used to generate other äccepting" sockets which establish a two way communications channel with the "connecting" socket.

If the port parameter is zero then the port number as defined by the object instance construction or the PIPSocket::SetPort() function.

For the UDP protocol, the queueSize parameter is ignored.

Returns:
TRUE if the channel was successfully opened.
Parameters:
queueSize - Number of pending accepts that may be queued.
port - Port number to use for the connection.
reuse - Can/Cant listen more than once.

ostatic PString GetHostName()
Get the öfficial" host name for the host specified or if none, the host this process is running on. The host may be specified as an IP number or a hostname alias and is resolved to the canonical form.

Returns:
Name of the host or IP number of host.

ostatic BOOL GetHostAddress( Address & addr )
Get the Internet Protocol address for the specified host, or if none specified, for the host this process is running on.

Returns:
TRUE if the IP number was returned.
Parameters:
addr - Variable to receive hosts IP address

ostatic PStringArray GetHostAliases( const PString & hostname )
Get the alias host names for the specified host. This includes all DNS names, CNAMEs, names in the local hosts file and IP numbers (as "dot" format strings) for the host.

Returns:
array of strings for each alias for the host.

ostatic BOOL IsLocalHost( const PString & hostname )
Determine if the specified host is actually the local machine. This can be any of the host aliases or multi-homed IP numbers or even the special number 127.0.0.1 for the loopback device.

Returns:
TRUE if the host is the local machine.

ovirtual BOOL GetLocalAddress( Address & addr )
Get the Internet Protocol address for the local host.

Returns:
TRUE if the IP number was returned.
Parameters:
addr - Variable to receive hosts IP address

ovirtual BOOL GetPeerAddress( Address & addr )
Get the Internet Protocol address for the peer host the socket is connected to.

Returns:
TRUE if the IP number was returned.
Parameters:
addr - Variable to receive hosts IP address

oPString GetLocalHostName()
Get the host name for the local host.

Returns:
Name of the host, or an empty string if an error occurs.

oPString GetPeerHostName()
Get the host name for the peer host the socket is connected to.

Returns:
Name of the host, or an empty string if an error occurs.

ostatic void ClearNameCache()
Clear the name (DNS) cache

ostatic BOOL GetGatewayAddress( Address & addr )
Get the IP address that is being used as the gateway, that is, the computer that packets on the default route will be sent.

The string returned may be used in the Connect() function to open that interface.

Note that the driver does not need to be open for this function to work.

Returns:
TRUE if there was a gateway.
Parameters:
addr - Variable to receive the IP address.

ostatic PString GetGatewayInterface()
Get the name for the interface that is being used as the gateway, that is, the interface that packets on the default route will be sent.

The string returned may be used in the Connect() function to open that interface.

Note that the driver does not need to be open for this function to work.

Returns:
String name of the gateway device, or empty string if there is none.

ostatic BOOL GetRouteTable( RouteTable & table )
Get the systems route table.

Returns:
TRUE if the route table is returned, FALSE if an error occurs.
Parameters:
table - Route table

ostatic BOOL GetInterfaceTable( InterfaceTable & table )
Get a list of all interfaces

Returns:
TRUE if the interface table is returned, FALSE if an error occurs.
Parameters:
table - interface table


Direct child classes:
PTCPSocket
PIPDatagramSocket

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.