TCP echo client using the WiConnect library and mbed TCP Socket API.

Dependencies:   WiConnect mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers tcp_echo_server.py Source File

tcp_echo_server.py

00001 import socket
00002  
00003 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
00004 s.bind(('', 7))
00005 s.listen(1)
00006  
00007 while True:
00008     conn, addr = s.accept()
00009     print 'Connected by', addr
00010     while True:
00011         data = conn.recv(1024)
00012         if not data: break
00013         conn.sendall(data)
00014     conn.close()