from socket import *
from struct import pack,unpack
import time 
import sys

def sendCommand(bytes):
	s = None
	try:
		s= socket(AF_INET,SOCK_STREAM)

		s.connect(('192.168.1.105', 5933))

		l = [chr(int(i, 16)).encode('ascii') for i in bytes.split(b' ')]
		b = b''.join(l)
		s.send(b)

		incomingBytes = s.recv(1024)

		return incomingBytes.split(b'\x03')[0]
	except Exception as e:
		print(e)
	finally:
		try:
			s.shutdown(SHUT_RDWR)
			s.close()
		except Exception:
			pass


incomingBytes = sendCommand(b'02 64 4F 4F 46 3F 03 1C')
sys.stdout.write(incomingBytes.decode('ascii')+'              \r')

