|
|
|
@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
|
|
|
|
|
#!/usr/bin/python |
|
|
|
|
#!/usr/bin/python3 |
|
|
|
|
|
|
|
|
|
import socket, sys, getopt |
|
|
|
|
|
|
|
|
@ -19,11 +19,11 @@ arguments = sys.argv[1:]
@@ -19,11 +19,11 @@ arguments = sys.argv[1:]
|
|
|
|
|
opts, args = getopt.getopt(arguments, options) |
|
|
|
|
|
|
|
|
|
for o, a in opts: |
|
|
|
|
print ' ', o, ' --> ', a |
|
|
|
|
print (' ', o, ' --> ', a) |
|
|
|
|
if "-v" == o: verbose += 1 |
|
|
|
|
elif "-p" == o: rx_port = int(a) |
|
|
|
|
|
|
|
|
|
print "listening port : ", rx_port |
|
|
|
|
print ("listening port : ", rx_port) |
|
|
|
|
|
|
|
|
|
# --- |
|
|
|
|
|
|
|
|
@ -34,7 +34,7 @@ for ligne in open("destinations.liste"):
@@ -34,7 +34,7 @@ for ligne in open("destinations.liste"):
|
|
|
|
|
if p: cibles.append((a, int(p))) |
|
|
|
|
|
|
|
|
|
for cible in cibles: |
|
|
|
|
print " -> ", cible |
|
|
|
|
print (" -> ", cible) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# point d'entree, d'ecoute |
|
|
|
@ -49,7 +49,7 @@ sock_tx = socket.socket(socket.AF_INET, # Internet
@@ -49,7 +49,7 @@ sock_tx = socket.socket(socket.AF_INET, # Internet
|
|
|
|
|
while True: |
|
|
|
|
data, addr = sock_rx.recvfrom(1024) # buffer size is 1024 bytes |
|
|
|
|
if verbose: |
|
|
|
|
print "got:", addr, " ", len(data) |
|
|
|
|
print ("got:", addr, " ", len(data)) |
|
|
|
|
for cible in cibles: |
|
|
|
|
# print cible |
|
|
|
|
sock_tx.sendto(data, cible) |
|
|
|
|