net0.py

#!/usr/bin/env python

import socket
import struct

IP="172.16.184.152"
PORT=2999


# Create client socket and connect to the IP/PORT
s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s1.connect((IP, PORT))

#x Receive data from the server
data = s1.recv(2048)
print data

number = int( data.split("'")[1] )
number_hex = hex(number)

number_le = struct.pack("<I", number)

number_le2 = struct.unpack(">I", number_le)[0]
number_hex_le2 = hex(number_le2)

print "Original number %s:, in hex format: %s" % (number, number_hex)
print "Little endian number %s:, in hex format: %s" % (number_le2, number_hex_le2)

# Send data to the server
s1.send(number_le)

# Receive data from the server
data = s1.recv(2048)
print data

# Close the socket
s1.close()

 

screen-shot-2016-12-01-at-20-57-18