MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / GetPort

Method GetPort

test/799.cpp:46–60  ·  view source on GitHub ↗

* Get the port. * @return the port. */

Source from the content-addressed store, hash-verified

44 * @return the port.
45 */
46uint16 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.

Callers 1

mainFunction · 0.80

Calls 2

printfFunction · 0.85
ntohsFunction · 0.85

Tested by

no test coverage detected