# wxIPV4address Class Reference
[Networking]

`#include <wx/socket.h>`

Inheritance diagram for wxIPV4address:
[legend]

## Detailed Description

A class for working with IPv4 network addresses.

##

Library: wxBase

Category: Networking

## Public Member Functions
bool | AnyAddress ()
| Set address to any of the addresses of the current machine.
bool | Hostname (const wxString &hostname)
| Set the address to hostname, which can be a host name or an IP-style address in dot notation(`a.b.c.d`).
virtual wxString | Hostname () const
| Returns the hostname which matches the IP address.
virtual wxString | IPAddress () const
| Returns a wxString containing the IP address in dot quad (127.0.0.1) format.
bool | LocalHost ()
| Set address to localhost (127.0.0.1).
bool | Service (const wxString &service)
| Set the port to that corresponding to the specified service.
bool | Service (unsigned short service)
| Set the port to that corresponding to the specified service.
unsigned short | Service () const
| Returns the current service.

List of all members.

## Member Function Documentation

bool wxIPV4address::AnyAddress | ( |  | ) |

Set address to any of the addresses of the current machine.

Whenever possible, use this function instead of LocalHost(), as this correctly handles multi-homed hosts and avoids other small problems. Internally, this is the same as setting the IP address to INADDR_ANY.

Returns:
  true on success, false if something went wrong.

Reimplemented from wxIPaddress.

virtual wxString wxIPV4address::Hostname | ( |  | ) | const`[virtual]`

Returns the hostname which matches the IP address.

Reimplemented from wxIPaddress.

bool wxIPV4address::Hostname | ( | const wxString & | hostname | ) |

Set the address to hostname, which can be a host name or an IP-style address in dot notation(`a.b.c.d`).

Returns:
  true on success, false if something goes wrong (invalid hostname or invalid IP address).

Reimplemented from wxIPaddress.

virtual wxString wxIPV4address::IPAddress | ( |  | ) | const`[virtual]`

Returns a wxString containing the IP address in dot quad (127.0.0.1) format.

Implements wxIPaddress.

bool wxIPV4address::LocalHost | ( |  | ) |

Set address to localhost (127.0.0.1).

Whenever possible, use AnyAddress() instead of this one, as that one will correctly handle multi-homed hosts and avoid other small problems.

Returns:
  true on success, false if something went wrong.

Reimplemented from wxIPaddress.

unsigned short wxIPV4address::Service | ( |  | ) | const

Returns the current service.

Reimplemented from wxIPaddress.

bool wxIPV4address::Service | ( | unsigned short | service | ) |

Set the port to that corresponding to the specified service.

Returns:
  true on success, false if something goes wrong (invalid service).

Reimplemented from wxIPaddress.

bool wxIPV4address::Service | ( | const wxString & | service | ) |

Set the port to that corresponding to the specified service.

Returns:
  true on success, false if something goes wrong (invalid service).

Reimplemented from wxIPaddress.

|  | [ top ]