Skip to content

Commit ad3c79b

Browse files
committed
Working on raw socket implementation.
1 parent 60f8af3 commit ad3c79b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pytcp/socket/raw__socket.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ def _get_ip_addresses(
126126
"[Errno -2] Name or service not known - "
127127
"[Malformed remote IP address]"
128128
)
129+
else:
130+
local_ip_address = self._local_ip_address
129131

130132
assert isinstance(local_ip_address, (Ip6Address, Ip4Address))
131133

@@ -171,6 +173,10 @@ def bind(self, address: tuple[str, int]) -> None:
171173
"[Errno -2] Name or service not known - "
172174
"[Malformed local IP address]"
173175
) from error
176+
case _:
177+
raise ValueError(
178+
f"Invalid address family: {self._address_family}"
179+
)
174180

175181
stack.sockets.pop(self.socket_id, None)
176182
self._local_ip_address = local_ip_address

0 commit comments

Comments
 (0)