| 390 | ################################################################ |
| 391 | |
| 392 | def getsockname(self) -> tuple[str, int] | tuple[str, int, int, int]: |
| 393 | self._check_closed() |
| 394 | if self._binding is not None: |
| 395 | return self._binding.local.as_python_sockaddr() |
| 396 | elif self.family == trio.socket.AF_INET: |
| 397 | return ("0.0.0.0", 0) |
| 398 | else: |
| 399 | assert self.family == trio.socket.AF_INET6 |
| 400 | return ("::", 0) |
| 401 | |
| 402 | # TODO: This method is not tested, and seems to make incorrect assumptions. It should maybe raise NotImplementedError. |
| 403 | def getpeername(self) -> tuple[str, int] | tuple[str, int, int, int]: |