File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,25 @@ def get_messages(self, timeout: int = 30) -> Generator:
121121 yield OscMessage (m )
122122 r = self .receive (timeout )
123123
124+ class TCPDispatchClient (SimpleTCPClient ):
125+ """OSC Client that includes a :class:`Dispatcher` for handling responses and other messages from the server"""
126+
127+ dispatcher = Dispatcher ()
128+
129+ def handle_messages (self , timeout : int = 30 ) -> None :
130+ """Wait :int:`timeout` seconds for a message from the server and process each message with the registered
131+ handlers. Continue until a timeout occurs.
132+
133+ Args:
134+ timeout: Time in seconds to wait for a message
135+ """
136+ r = self .receive (timeout )
137+ while r :
138+ for m in r :
139+ self .dispatcher .call_handlers_for_packet (m , (self .address , self .port ))
140+ r = self .receive (timeout )
141+
142+
124143
125144class AsyncTCPClient :
126145 """Async OSC client to send :class:`OscMessage` or :class:`OscBundle` via TCP"""
You can’t perform that action at this time.
0 commit comments