Skip to content

Conversation

@jms5194
Copy link
Contributor

@jms5194 jms5194 commented Oct 21, 2025

Adds a TCPDispatch client to tcp_client.py follow the same concept of the DispatchClient that is already in udp_client.py. Currently, there is only an async version in tcp_client.py.


dispatcher = Dispatcher()

def handle_messages(self, timeout: int = 30) -> None:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please suffix the arg with the unit, it's not typed so it makes it explicit/easier on the clients to understand.

timeout_sec: int = 30

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed, thanks.

while r:
for m in r:
self.dispatcher.call_handlers_for_packet(m, (self.address, self.port))
r = self.receive(timeout)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldn't change r if you're looping over it already

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, bad tab placement, sorry, fixed.

@attwad attwad merged commit f1e3e31 into attwad:main Oct 25, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants