コード例 #1
0
ファイル: client.py プロジェクト: megaleunam/UDPpython
import sys      #para entrada de datos
from form import Form #Formulario 
import pickle #serializacion y codificacion function dumbs() and loads()
 
# create dgram udp socket
try:
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
except socket.error:
    print ('Falla al Crear Socket')
    sys.exit()
 
host = 'localhost';
port = 7890;

formulario = Form()
nombre = formulario.getName()
apellido = formulario.getLastName()
ci = formulario.getCI()
f_n = formulario.getDate()
lugar_n = formulario.getPlace()
f_array = formulario.getFotoArray() #bytes de la foto 
#array de bytes de la foto
obj = formulario.getSerialize()
b=True
while(b) :
    
    try :
        #Set the whole string
        s.sendto(obj, (host, port)) #msg.encode()
        # for x in f_array:
        #     s.sendto(x, (host, port))