def send_and_get_reply(self, *args) -> str: msg = msg_from_args(*args) log.debug("Immediate socket sending: " + msg) socket_sendall(self.immsock, msg + "\n") reply = next(self.getlines_immsock()) log.debug("Immediate socket reply: " + reply) return reply
def sendline_immsock(self, *args) -> None: msg = msg_from_args(*args) self.debug("Sending to server (IMM): {}".format(msg)) final_str = msg + EOL data_bytes = final_str.encode(ENCODING) self.immsocket.write(data_bytes) self.immsocket.waitForBytesWritten(INFINITE_WAIT) # http://doc.qt.io/qt-4.8/qabstractsocket.html self.immsocket.flush()
def send(self, *args) -> None: if not self.mainsocket: log.error("can't send without a mainsocket") return msg = msg_from_args(*args) self.mainsocket.send(msg)