net1.py

#!/usr/bin/env python

import socket
import struct

IP="172.16.184.152"
PORT=2998


# 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)

number = struct.unpack("<I", data)[0]
number_str = str(number)
print "Received number: %s" % (number_str)

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

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

# Close the socket
s1.close()

 

screen-shot-2016-12-01-at-21-07-43