diff options
author | Grissess <grissess@nexusg.org> | 2016-04-02 00:02:48 -0400 |
---|---|---|
committer | Grissess <grissess@nexusg.org> | 2016-04-02 00:02:48 -0400 |
commit | 5eb82698723a95d8e8838ad0e09b6f392a535d9e (patch) | |
tree | c6df69efb5cfc776359e48c5fdf9b82461682c94 /broadcast.py | |
parent | c18fea05f21e0b2927a378c545b86837c3a55794 (diff) |
GUI and bind addresses
Diffstat (limited to 'broadcast.py')
-rw-r--r-- | broadcast.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/broadcast.py b/broadcast.py index 0c2d8c6..da0ee00 100644 --- a/broadcast.py +++ b/broadcast.py @@ -29,8 +29,9 @@ parser.add_option('-f', '--factor', dest='factor', type='float', help='Rescale t parser.add_option('-r', '--route', dest='routes', action='append', help='Add a routing directive (see --route-help)') parser.add_option('-v', '--verbose', dest='verbose', action='store_true', help='Be verbose; dump events and actual time (can slow down performance!)') parser.add_option('-W', '--wait-time', dest='wait_time', type='float', help='How long to wait for clients to initially respond (delays all broadcasts)') +parser.add_option('-B', '--bind-addr', dest='bind_addr', help='The IP address (or IP:port) to bind to (influences the network to send to)') parser.add_option('--help-routes', dest='help_routes', action='store_true', help='Show help about routing directives') -parser.set_defaults(routes=[], random=0.0, rand_low=80, rand_high=2000, live=None, factor=1.0, duration=1.0, volume=255, wait_time=0.25, play=[], transpose=0, seek=0.0) +parser.set_defaults(routes=[], random=0.0, rand_low=80, rand_high=2000, live=None, factor=1.0, duration=1.0, volume=255, wait_time=0.25, play=[], transpose=0, seek=0.0, bind_addr='') options, args = parser.parse_args() if options.help_routes: @@ -56,6 +57,11 @@ print 'Factor:', factor s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) +if options.bind_addr: + addr, _, port = options.bind_addr.partition(':') + if not port: + port = '12074' + s.bind((addr, int(port))) clients = [] uid_groups = {} |