* Returns the `Address` with the assigned ip and assigned port. * * @return An `Address` or an error if the `getsockname` system call * fails or the family type is not supported. */
| 77 | * fails or the family type is not supported. |
| 78 | */ |
| 79 | inline Try<Address> address(int_fd s) |
| 80 | { |
| 81 | sockaddr_storage storage; |
| 82 | socklen_t length = sizeof(storage); |
| 83 | |
| 84 | if (::getsockname(s, (sockaddr*)&storage, &length) < 0) { |
| 85 | return ErrnoError("Failed to getsockname"); |
| 86 | } |
| 87 | |
| 88 | return Address::create(storage); |
| 89 | } |
| 90 | |
| 91 | |
| 92 | /** |
no outgoing calls