------------------------------------------------------------------------------
| 498 | |
| 499 | //------------------------------------------------------------------------------ |
| 500 | int vtkSocket::GetPort(int sock) |
| 501 | { |
| 502 | #ifndef VTK_SOCKET_FAKE_API |
| 503 | struct sockaddr_in sockinfo; |
| 504 | memset(&sockinfo, 0, sizeof(sockinfo)); |
| 505 | #if defined(VTK_HAVE_GETSOCKNAME_WITH_SOCKLEN_T) |
| 506 | socklen_t sizebuf = sizeof(sockinfo); |
| 507 | #else |
| 508 | int sizebuf = sizeof(sockinfo); |
| 509 | #endif |
| 510 | |
| 511 | int iErr; |
| 512 | vtkRestartInterruptedSystemCallMacro( |
| 513 | getsockname(sock, reinterpret_cast<sockaddr*>(&sockinfo), &sizebuf), iErr); |
| 514 | if (iErr == vtkSocketErrorReturnMacro) |
| 515 | { |
| 516 | vtkSocketErrorMacro(vtkErrnoMacro, "Socket error in call to getsockname."); |
| 517 | return 0; |
| 518 | } |
| 519 | return ntohs(sockinfo.sin_port); |
| 520 | #else |
| 521 | static_cast<void>(sock); |
| 522 | return -1; |
| 523 | #endif |
| 524 | } |
| 525 | |
| 526 | //------------------------------------------------------------------------------ |
| 527 | void vtkSocket::CloseSocket(int socketdescriptor) |
no outgoing calls
no test coverage detected