# PSocksUDPSocket Class Reference

This class allows access to RFC1928 compliant SOCKS server. More...

`#include <socks.h>`

Inheritance diagram for PSocksUDPSocket:

List of all members.

## Public Member Functions

| PSocksUDPSocket (WORD port=0)
| PSocksUDPSocket (const PString &host, WORD port=0)
virtual PObject * | Clone () const
| Create a copy of the class on the heap.
virtual PBoolean | Connect (const PString &address)
| Connect a socket to a remote host on the specified port number.
virtual PBoolean | Connect (const Address &addr)
virtual PBoolean | Listen (unsigned queueSize=5, WORD port=0, Reusability reuse=AddressIsExclusive)
| Listen on a socket for a remote host on the specified port number.
virtual PBoolean | GetLocalAddress (Address &addr)
| Get the Internet Protocol address for the local host.
virtual PBoolean | GetLocalAddress (Address &addr, WORD &port)
virtual PBoolean | GetPeerAddress (Address &addr)
| Get the Internet Protocol address for the peer host the socket is connected to.
virtual PBoolean | GetPeerAddress (Address &addr, WORD &port)
virtual PBoolean | ReadFrom (void *buf, PINDEX len, Address &addr, WORD &port)
| Read a datagram from a remote computer.
virtual PBoolean | WriteTo (const void *buf, PINDEX len, const Address &addr, WORD port)
| Write a datagram to a remote computer.

## Protected Member Functions

virtual void | SetErrorCodes (PChannel::Errors errCode, int osErr)

## Protected Attributes

PTCPSocket | socksControl
Address | serverAddress

## Detailed Description

This class allows access to RFC1928 compliant SOCKS server.

## Constructor & Destructor Documentation

PSocksUDPSocket::PSocksUDPSocket | ( | WORD | port = `0` | ) |

PSocksUDPSocket::PSocksUDPSocket | ( | const PString & | host,
|  | WORD | port = `0` |
| ) |  |  |

## Member Function Documentation

virtual PObject* PSocksUDPSocket::Clone | ( |  | ) | const`[virtual]`

Create a copy of the class on the heap.

The exact semantics of the descendent class determine what is required to make a duplicate of the instance. Not all classes can even do a clone operation.

The main user of the clone function is the PDictionary class as it requires copies of the dictionary keys.

The default behaviour is for this function to assert.

Returns:
  pointer to new copy of the class instance.

Reimplemented from PObject.

virtual PBoolean PSocksUDPSocket::Connect | ( | const Address & | addr | ) | `[virtual]`

virtual PBoolean PSocksUDPSocket::Connect | ( | const PString & | address | ) | `[virtual]`

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.

Reimplemented from PUDPSocket.

virtual PBoolean PSocksUDPSocket::GetLocalAddress | ( | Address & | addr,
|  | WORD & | port |
| ) |  |  | `[virtual]`

virtual PBoolean PSocksUDPSocket::GetLocalAddress | ( | Address & | addr | ) | `[virtual]`

Get the Internet Protocol address for the local host.

Returns:
  true if the IP number was returned.

virtual PBoolean PSocksUDPSocket::GetPeerAddress | ( | Address & | addr,
|  | WORD & | port |
| ) |  |  | `[virtual]`

virtual PBoolean PSocksUDPSocket::GetPeerAddress | ( | Address & | addr | ) | `[virtual]`

Get the Internet Protocol address for the peer host the socket is connected to.

Returns:
  true if the IP number was returned.

virtual PBoolean PSocksUDPSocket::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.

Returns:
  true if the channel was successfully opened.

Reimplemented from PIPSocket.

virtual PBoolean PSocksUDPSocket::ReadFrom | ( | void * | buf,
|  | PINDEX | len,
|  | Address & | addr,
|  | WORD & | port |
| ) |  |  | `[virtual]`

Read a datagram from a remote computer.

Returns:
  true if any bytes were sucessfully read.

Reimplemented from PIPDatagramSocket.

virtual void PSocksUDPSocket::SetErrorCodes | ( | PChannel::Errors | errCode,
|  | int | osErr |
| ) |  |  | `[protected, virtual]`

Implements PSocksProtocol.

virtual PBoolean PSocksUDPSocket::WriteTo | ( | const void * | buf,
|  | PINDEX | len,
|  | const Address & | addr,
|  | WORD | port |
| ) |  |  | `[virtual]`

Write a datagram to a remote computer.

Returns:
  true if all the bytes were sucessfully written.

Reimplemented from PIPDatagramSocket.

## Member Data Documentation

Address PSocksUDPSocket::serverAddress `[protected]`

PTCPSocket PSocksUDPSocket::socksControl `[protected]`

The documentation for this class was generated from the following file:

- socks.h