#include <socks.h>
Inheritance diagram for PSocksSocket:
Public Member Functions | |
PSocksSocket (WORD port=0) | |
virtual PBoolean | Connect (const PString &address) |
virtual PBoolean | Connect (const Address &addr) |
virtual PBoolean | Listen (unsigned queueSize=5, WORD port=0, Reusability reuse=AddressIsExclusive) |
PBoolean | Accept () |
virtual PBoolean | Accept (PSocket &socket) |
virtual PBoolean | GetLocalAddress (Address &addr) |
virtual PBoolean | GetLocalAddress (Address &addr, WORD &port) |
virtual PBoolean | GetPeerAddress (Address &addr) |
virtual PBoolean | GetPeerAddress (Address &addr, WORD &port) |
Protected Member Functions | |
virtual void | SetErrorCodes (PChannel::Errors errCode, int osErr) |
int | TransferHandle (PSocksSocket &destination) |
PSocksSocket::PSocksSocket | ( | WORD | port = 0 |
) |
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.
address | Address of remote machine to connect to. |
Reimplemented from PIPSocket.
virtual PBoolean PSocksSocket::Connect | ( | const Address & | addr | ) | [virtual] |
addr | Address of remote machine to connect to. |
virtual PBoolean PSocksSocket::Listen | ( | unsigned | queueSize = 5 , |
|
WORD | port = 0 , |
|||
Reusability | reuse = AddressIsExclusive | |||
) | [virtual] |
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 "accepting" 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.
queueSize | Number of pending accepts that may be queued. |
port | Port number to use for the connection. |
reuse | Can/Cant listen more than once. |
Reimplemented from PTCPSocket.
PBoolean PSocksSocket::Accept | ( | ) |
Open a socket to a remote host on the specified port number. This is an "accepting" socket. When a "listening" socket has a pending connection to make, this will accept a connection made by the "connecting" socket created to establish a link.
The port that the socket uses is the one used in the Listen() command of the socket
parameter.
Note that this function will block until a remote system connects to the port number specified in the "listening" socket.
A further note is that when the version that uses a parameter is used, the socket
parameter is automatically closed and its operating system handle transferred to the current object. This occurs regardless of the return value of the function.
Open a socket to a remote host on the specified port number. This is an "accepting" socket. When a "listening" socket has a pending connection to make, this will accept a connection made by the "connecting" socket created to establish a link.
The port that the socket uses is the one used in the Listen()# command of the socket# parameter.
Note that this function will block until a remote system connects to the port number specified in the "listening" socket.
socket | Listening socket making the connection. |
Reimplemented from PTCPSocket.
virtual PBoolean PSocksSocket::GetLocalAddress | ( | Address & | addr | ) | [virtual] |
Get the Internet Protocol address for the local host.
addr | Variable to receive hosts IP address |
virtual PBoolean PSocksSocket::GetLocalAddress | ( | Address & | addr, | |
WORD & | port | |||
) | [virtual] |
addr | Variable to receive peer hosts IP address |
port | Variable to receive peer hosts port number |
virtual PBoolean PSocksSocket::GetPeerAddress | ( | Address & | addr | ) | [virtual] |
Get the Internet Protocol address for the peer host the socket is connected to.
addr | Variable to receive hosts IP address |
virtual PBoolean PSocksSocket::GetPeerAddress | ( | Address & | addr, | |
WORD & | port | |||
) | [virtual] |
addr | Variable to receive peer hosts IP address |
port | Variable to receive peer hosts port number |
virtual void PSocksSocket::SetErrorCodes | ( | PChannel::Errors | errCode, | |
int | osErr | |||
) | [protected, virtual] |
Implements PSocksProtocol.
int PSocksSocket::TransferHandle | ( | PSocksSocket & | destination | ) | [protected] |