Dear all
I am trying to send request to client device in Hex format and receive data into decimal format. By seeing forum and tutorial class. I could able to send and receive data from client device.Now I wanted to check the data i received valid or not. In order to test it i wanted to convert the data from hex to dec. I am also confused How client data being received here.
My code:
import socket
TCP_IP = '192.168.1.3'
TCP_PORT = 8899
BUFFER_SIZE = 1000
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send('01030000001d85c3'.decode('hex'))
Decode_hex='01030000001d85c3'.decode('hex')
print Decode_hex
print "decode hex:",Decode_hex
data = s.recv(1024)
s.close()
print "data recieved :", data
d=data.encode('hex').upper()
print 'Hexa decimal value deceived:',repr(d)
mod_hex=data.encode('hex').upper()
print 'Hexa decimal value Modified:',repr(mod_hex)
#print 'received',d
decimal=int(d,16)
print "decimal converted value:",decimal
Here is my out put file
decode hex:
data recieved : :
Hexa decimal value deceived: '01033A0000000D00120041003400410056004B000000000000000000DF000000E1000000E700F800E600EC0000000000000000001F00010001000100DC496E'
Hexa decimal value Modified: '01033A0000000D00120041003400410056004B000000000000000000DF000000E1000000E700F800E600EC0000000000000000001F00010001000100DC496E'
decimal converted value: 214364598880234057828928146607817359105482384449559342919180352622648369076567392756173653847449417881349290133492250705920000000000003670016655364096025643555734
Here is output with wired connection.I expected Outpu like above format
If i used encode ('Hex') i wont get any reply from client device
if i use decode('HEX') i am getting reply like above.
Please guide me to get out from cleint device