* Get the port. * @return the port. */
| 44 | * @return the port. |
| 45 | */ |
| 46 | uint16 NetworkAddress::GetPort() const |
| 47 | { |
| 48 | printf("Get PORT family: %d\n", this->address.ss_family); |
| 49 | switch (this->address.ss_family) { |
| 50 | case AF_UNSPEC: |
| 51 | case AF_INET: |
| 52 | return ntohs(((const struct sockaddr_in *)&this->address)->sin_port); |
| 53 | |
| 54 | case AF_INET6: |
| 55 | return ntohs(((const struct sockaddr_in6 *)&this->address)->sin6_port); |
| 56 | |
| 57 | default: |
| 58 | throw 0; |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Set the port. |