def handle(self): data = self.request[0].strip() print('.' * 70) psize = len(data) print('Received data at {}. Packet size in bytes: {} ({})'.format( get_time(), psize, byte_to_text(psize))) print(':' * 70)
def onMessage(data): print('.' * 70) psize = len(data) print('Received data at {}. Packet size in bytes: {} ({})'.format( get_time(), psize, byte_to_text(psize) )) print(':' * 70)
def handle(self): data = self.request.recv(MAX_PACKET_SIZE).strip() print('.' * 70) psize = len(data) print('Received data at {}. Packet size in bytes: {} ({})'.format( get_time(), psize, byte_to_text(psize) )) self.request.sendall(data) print(':' * 70)
def send(message): print('.' * 70) print('Sending data at {}'.format(get_time())) normal_mem_usage = get_memory_usage() msg_size = len(message) print('Packet size in bytes: {} ({})'.format(msg_size, byte_to_text(msg_size))) print('Normal memory usage:', byte_to_text(normal_mem_usage, 5)) sio.emit('message', message, namespace=NAMESPACE) sending_mem_usage = get_memory_usage() print('Memory usage while sending:', byte_to_text(sending_mem_usage, 5))
def send(message): try: print('.' * 70) print('Sending data at {}'.format(get_time())) normal_mem_usage = get_memory_usage() msg_size = len(message) print('Packet size in bytes: {} ({})'.format(msg_size, byte_to_text(msg_size))) print('Normal memory usage:', byte_to_text(normal_mem_usage, 5)) client.sendto(message, (HOST, PORT)) sending_mem_usage = get_memory_usage() print('Memory usage while sending:', byte_to_text(sending_mem_usage, 5)) except BaseException as e: print(e) pass
def send(message): try: print('.' * 70) print('Sending data at {}'.format(get_time())) normal_mem_usage = get_memory_usage() msg_size = len(message) print('Packet size in bytes: {} ({})'.format( msg_size, byte_to_text(msg_size))) print('Normal memory usage:', byte_to_text(normal_mem_usage, 5)) self.sendMessage(message, isBinary=True) sending_mem_usage = get_memory_usage() print('Memory usage while sending:', byte_to_text(sending_mem_usage, 5)) except Exception as err: print(err) pass
def send(message): print('.' * 70) print('Sending data at {}'.format(get_time())) normal_mem_usage = get_memory_usage() msg_size = len(message) print( 'Packet size in bytes: {} ({})'.format( msg_size, byte_to_text(msg_size) ) ) print('Normal memory usage:', byte_to_text(normal_mem_usage, 5)) r.publish(CHANNEL, message) sending_mem_usage = get_memory_usage() print( 'Memory usage while sending:', byte_to_text(sending_mem_usage, 5) )
def send(message): try: client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.settimeout(SOC_TIMEOUT) client.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) client.connect((HOST, PORT)) print('.' * 70) print('Sending data at {}'.format(get_time())) normal_mem_usage = get_memory_usage() msg_size = len(message) print('Packet size in bytes: {} ({})'.format(msg_size, byte_to_text(msg_size))) print('Normal memory usage:', byte_to_text(normal_mem_usage, 5)) client.sendall(message) sending_mem_usage = get_memory_usage() print('Memory usage while sending:', byte_to_text(sending_mem_usage, 5)) except BaseException as e: print(e) pass