Send a single frame. Args: frame: Frame bytes to send
(self, frame: bytes)
| 133 | t.start() |
| 134 | |
| 135 | def send_frame(self, frame: bytes) -> None: |
| 136 | """ |
| 137 | Send a single frame. |
| 138 | |
| 139 | Args: |
| 140 | frame: Frame bytes to send |
| 141 | """ |
| 142 | if not self._running: |
| 143 | raise RuntimeError("Simulator not started") |
| 144 | |
| 145 | if self.protocol == "tcp": |
| 146 | if not self._client_socket: |
| 147 | raise RuntimeError("No client connected") |
| 148 | try: |
| 149 | self._client_socket.sendall(frame) |
| 150 | except (BrokenPipeError, ConnectionResetError): |
| 151 | self._client_socket = None |
| 152 | raise RuntimeError("Client disconnected") |
| 153 | else: |
| 154 | self._socket.sendto(frame, (self.host, self.port)) |
| 155 | |
| 156 | def send_frames( |
| 157 | self, |
no outgoing calls