UDP echo client using the WiConnect Library and mbed UDP Socket API.

Dependencies:   WiConnect mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers udp_echo_server.py Source File

udp_echo_server.py

00001 import socket
00002  
00003 ECHO_PORT = 7
00004  
00005 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
00006 sock.bind(('', ECHO_PORT))
00007  
00008 while True:
00009     data, address = sock.recvfrom(256)
00010     print "datagram from", address
00011     sock.sendto(data, address)