| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -121,6 +121,25 @@ def get_messages(self, timeout: int = 30) -> Generator: | |||
| 121 | 121 | yield OscMessage(m) | |
| 122 | 122 | r = self.receive(timeout) | |
| 123 | 123 | ||
| 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 | + | ||
| 124 | 143 | ||
| 125 | 144 | class AsyncTCPClient: | |
| 126 | 145 | """Async OSC client to send :class:`OscMessage` or :class:`OscBundle` via TCP""" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments