From 5a89a7a4bcd3be2356f3ead74a375fe0ce539463 Mon Sep 17 00:00:00 2001 From: jms5194 Date: Mon, 20 Oct 2025 16:11:41 -0400 Subject: [PATCH 1/5] adding TCPDispatchClient Class --- pythonosc/tcp_client.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pythonosc/tcp_client.py b/pythonosc/tcp_client.py index 512b666..3a6c63c 100644 --- a/pythonosc/tcp_client.py +++ b/pythonosc/tcp_client.py @@ -121,6 +121,25 @@ def get_messages(self, timeout: int = 30) -> Generator: yield OscMessage(m) r = self.receive(timeout) +class TCPDispatchClient(SimpleTCPClient): + """OSC Client that includes a :class:`Dispatcher` for handling responses and other messages from the server""" + + dispatcher = Dispatcher() + + def handle_messages(self, timeout: int = 30) -> None: + """Wait :int:`timeout` seconds for a message from the server and process each message with the registered + handlers. Continue until a timeout occurs. + + Args: + timeout: Time in seconds to wait for a message + """ + r = self.receive(timeout) + while r: + for m in r: + self.dispatcher.call_handlers_for_packet(m, (self.address, self.port)) + r = self.receive(timeout) + + class AsyncTCPClient: """Async OSC client to send :class:`OscMessage` or :class:`OscBundle` via TCP""" From 594ed0285f108340c74361a296df232ffbf1e852 Mon Sep 17 00:00:00 2001 From: jms5194 Date: Mon, 20 Oct 2025 16:23:11 -0400 Subject: [PATCH 2/5] adding TCPDispatchClient Class --- pythonosc/tcp_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonosc/tcp_client.py b/pythonosc/tcp_client.py index 3a6c63c..a838c22 100644 --- a/pythonosc/tcp_client.py +++ b/pythonosc/tcp_client.py @@ -122,7 +122,7 @@ def get_messages(self, timeout: int = 30) -> Generator: r = self.receive(timeout) class TCPDispatchClient(SimpleTCPClient): - """OSC Client that includes a :class:`Dispatcher` for handling responses and other messages from the server""" + """OSC TCP Client that includes a :class:`Dispatcher` for handling responses and other messages from the server""" dispatcher = Dispatcher() From 51d3a5b3ee00f2e41520fba7e67b42c9bd180e1a Mon Sep 17 00:00:00 2001 From: jms5194 Date: Mon, 20 Oct 2025 16:24:24 -0400 Subject: [PATCH 3/5] updates for Lint --- pythonosc/tcp_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonosc/tcp_client.py b/pythonosc/tcp_client.py index a838c22..162a3f2 100644 --- a/pythonosc/tcp_client.py +++ b/pythonosc/tcp_client.py @@ -121,6 +121,7 @@ def get_messages(self, timeout: int = 30) -> Generator: yield OscMessage(m) r = self.receive(timeout) + class TCPDispatchClient(SimpleTCPClient): """OSC TCP Client that includes a :class:`Dispatcher` for handling responses and other messages from the server""" @@ -140,7 +141,6 @@ def handle_messages(self, timeout: int = 30) -> None: r = self.receive(timeout) - class AsyncTCPClient: """Async OSC client to send :class:`OscMessage` or :class:`OscBundle` via TCP""" From a75800537dafb431009db1221ed6acca8b6217be Mon Sep 17 00:00:00 2001 From: jms5194 Date: Tue, 21 Oct 2025 12:12:10 -0400 Subject: [PATCH 4/5] modified changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c3a803..01a9d9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [Unreleased] +- Added TCPDispatchClient to tcp_client - Fixed TPC dispatcher type annotations ## [1.9.3] From 8677a061e8f28c44554f3c8f5f6fc721918ef0a5 Mon Sep 17 00:00:00 2001 From: jms5194 Date: Sat, 25 Oct 2025 07:58:02 -0400 Subject: [PATCH 5/5] update to arg, requested changes --- pythonosc/tcp_client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pythonosc/tcp_client.py b/pythonosc/tcp_client.py index 162a3f2..4ca622c 100644 --- a/pythonosc/tcp_client.py +++ b/pythonosc/tcp_client.py @@ -127,18 +127,18 @@ class TCPDispatchClient(SimpleTCPClient): dispatcher = Dispatcher() - def handle_messages(self, timeout: int = 30) -> None: + def handle_messages(self, timeout_sec: int = 30) -> None: """Wait :int:`timeout` seconds for a message from the server and process each message with the registered handlers. Continue until a timeout occurs. Args: timeout: Time in seconds to wait for a message """ - r = self.receive(timeout) + r = self.receive(timeout_sec) while r: for m in r: self.dispatcher.call_handlers_for_packet(m, (self.address, self.port)) - r = self.receive(timeout) + r = self.receive(timeout_sec) class AsyncTCPClient: