[riot-notifications] [RIOT] sniffer: extend script to support sockets (#3884)

Martine Lenders notifications at github.com
Wed Sep 30 14:06:39 CEST 2015


> +        except IOError:
> +            print("error opening serial port", file=sys.stderr)
> +            sys.exit(2)
> +    elif connType == "socket":
> +        host = argv[2]
> +        port = int(argv[3])
> +
> +        try:
> +            sock = socket.socket()
> +            sock.connect((host, port))
> +            conn = sock.makefile("r+b", bufsize=0)
> +        except IOError:
> +            print("error connecting to %s:%s" % (host, port), file=sys.stderr)
> +            sys.exit(2)
> +    else:
> +        print("error: unsupported connection type. Use \"serial\" or \"socket\"")

Might be a good idea to put all this into its own function.

---
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/3884/files#r40785640
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20150930/614b9de5/attachment-0001.html>


More information about the notifications mailing list