# Echo client program
import socket

HOST = ''    # The remote host

# to act as a client
PORT = 50008              # The server port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))

# to act as a server
myport = 60001  # my port that can be used by the server
s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s2.bind((HOST,myport))
s2.listen(1)

# APPLICATION
s.send(str(myport) + ' is my port')
data = s.recv(1024)
x = data.split(" ")
print(' '.join(x))

conn, addr = s2.accept()
data = conn.recv(1024)
indata = data.split(" ")
print(' '.join(indata))
conn.send("Thank you server, I have received your ack")


s.close()
# print 'Received', repr(data)
