From 21a12bbf95405f41f940b1ce684405706b89ce7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Tue, 25 Mar 2014 22:30:30 +0100 Subject: [PATCH] prepared sensors2osc for ip family selection --- sensors2osc/sensors2osc/common.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sensors2osc/sensors2osc/common.py b/sensors2osc/sensors2osc/common.py index 25d6217..d34f4a3 100644 --- a/sensors2osc/sensors2osc/common.py +++ b/sensors2osc/sensors2osc/common.py @@ -25,7 +25,8 @@ import os.path import serial import socket -from chaosc.argparser_groups import * +from chaosc.argparser_groups import create_arg_parser, finalize_arg_parser, add_chaosc_group + try: from chaosc.c_osc_lib import OSCMessage @@ -38,7 +39,7 @@ class Platform(object): def __init__(self, args): self.args = args self.serial_sock = None - self.osc_sock = socket.socket(10, 2, 17) + self.osc_sock = socket.socket(args.address_family, 2, 17) self.osc_sock.connect((self.args.chaosc_host, self.args.chaosc_port)) @@ -76,6 +77,8 @@ def create_args(name): type=str, help='device node under /dev') main_group.add_argument("-a", '--actor', required=True, type=str, help='actor name') + main_group.add_argument('-4', '--ipv4_only', action="store_true", + help='select ipv4 sockets, defaults tp ipv6"') add_chaosc_group(arg_parser) args = finalize_arg_parser(arg_parser)