connect to server socket and start receiving thread
(self, host, port)
| 147 | return hdr |
| 148 | |
| 149 | def connect_socket(self, host, port): |
| 150 | """ |
| 151 | connect to server socket and start receiving thread |
| 152 | """ |
| 153 | self.logger.info("opening connection") |
| 154 | # Create socket with timeout for initial connection |
| 155 | sock = socket.create_connection((host, port), timeout=self.timeout) |
| 156 | # set to blocking mode again |
| 157 | sock.settimeout(None) |
| 158 | # nodelay necessary to avoid packing in one frame, some servers do not like it |
| 159 | sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) |
| 160 | self._socket = ua.utils.SocketWrapper(sock) |
| 161 | self.start() |
| 162 | |
| 163 | def disconnect_socket(self): |
| 164 | self.logger.info("Request to close socket received") |