示例#1
0
 
# 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))
        #s.sendto('fin'.encode(), (host, port))
        #s.sendto(foto, (host, port))