import socket
from sys import argv
def main():
s = socket.socket()
s.connect(("localhost", int(argv[1])))
while True:
mensaje = raw_input(">")
s.send(mensaje)
x = float(s.recv(4096))
x = x / 0.02
y = x
print "Y : ",y
mensaje = raw_input("> Como te llamas? ")
Llaves = open(mensaje+\'.txt\', \'r\')
nombre = mensaje
Llaves = Llaves.readline()
Llaves = Llaves.split(\',\')
print "Tu llave publica es ",Llaves[0]," ",Llaves[1]
d = float(Llaves[0])
n = float(Llaves[1])
r = ( ( y ** d ) % n)
print "d: ",d
print "n: ",n
print "r : ", r
mensaje = raw_input("> Envia tu nombre y tu r separado por commas (para identificarte con el servidor): ")
s.send(mensaje)
respuesta = s.recv(4096)
print respuesta
if mensaje == "quit":
break
s.close()
main()