Hello Everyone,
Can i get a example code or sample code on the TCP server using the CMSIS network library
Here's something i knocked up a few years ago as a simple test:
#!/usr/bin/env python import socket,traceback host = '192.168.1.111' port = 67 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) s.bind((host, port)) while 1: try: message, address = s.recvfrom(8192) print("DHCP Request detected") except (KeyboardInterrupt, SystemExit): raise
With a little work, this could become a useful DHCP server. I'll let you figure out how.