MCPcopy Create free account
hub / github.com/cuberite/cuberite / GetPort

Method GetPort

src/OSSupport/Socket.cpp:343–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341
342
343unsigned short cSocket::GetPort(void) const
344{
345 ASSERT(IsValid());
346
347 sockaddr_in Addr;
348 socklen_t AddrSize = sizeof(Addr);
349 if (getsockname(m_Socket, (sockaddr *)&Addr, &AddrSize) != 0)
350 {
351 return 0;
352 }
353 return ntohs(Addr.sin_port);
354}
355
356
357

Callers 2

StartMethod · 0.80
ExecuteMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected