Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pim_dm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
pim_dm
Commits
fa26ffa6
Commit
fa26ffa6
authored
Feb 04, 2018
by
Pedro Oliveira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix pip install failure && client.py and server.py dont throw exception after Ctrl^C
parent
a11b869c
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
88 additions
and
19 deletions
+88
-19
emulation/client1.startup
emulation/client1.startup
+1
-1
emulation/client1/root/client.py
emulation/client1/root/client.py
+14
-1
emulation/client1/root/server.py
emulation/client1/root/server.py
+13
-3
emulation/client2.startup
emulation/client2.startup
+1
-1
emulation/client2/root/client.py
emulation/client2/root/client.py
+14
-1
emulation/client2/root/server.py
emulation/client2/root/server.py
+13
-3
emulation/client3.startup
emulation/client3.startup
+1
-1
emulation/client3/root/client.py
emulation/client3/root/client.py
+14
-1
emulation/client3/root/server.py
emulation/client3/root/server.py
+13
-3
emulation/router1/root/script.sh
emulation/router1/root/script.sh
+1
-1
emulation/router2/root/script.sh
emulation/router2/root/script.sh
+1
-1
emulation/router3/root/script.sh
emulation/router3/root/script.sh
+1
-1
emulation/router4/root/script.sh
emulation/router4/root/script.sh
+1
-1
No files found.
emulation/client1.startup
View file @
fa26ffa6
...
@@ -7,4 +7,4 @@ ip route add 0.0.0.0/0 via 10.1.0.2
...
@@ -7,4 +7,4 @@ ip route add 0.0.0.0/0 via 10.1.0.2
# install python
# install python
apt-get update && apt-get --assume-yes install python3 python3-pip
apt-get update && apt-get --assume-yes install python3 python3-pip
pip-3.2 install netifaces
pip-3.2 install
--index-url=https://pypi.python.org/simple/
netifaces
emulation/client1/root/client.py
View file @
fa26ffa6
...
@@ -2,7 +2,16 @@ import socket
...
@@ -2,7 +2,16 @@ import socket
import
struct
import
struct
import
sys
import
sys
import
netifaces
import
netifaces
import
signal
import
sys
is_running
=
True
sock
=
None
def
exit
(
signal
,
frame
):
is_running
=
False
sock
.
close
()
sys
.
exit
(
0
)
def
chooseInterface
():
def
chooseInterface
():
interfaces
=
netifaces
.
interfaces
()
interfaces
=
netifaces
.
interfaces
()
...
@@ -25,6 +34,10 @@ def chooseInterface():
...
@@ -25,6 +34,10 @@ def chooseInterface():
if
not
hasattr
(
socket
,
'SO_BINDTODEVICE'
):
if
not
hasattr
(
socket
,
'SO_BINDTODEVICE'
):
socket
.
SO_BINDTODEVICE
=
25
socket
.
SO_BINDTODEVICE
=
25
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
multicast_group
=
'224.12.12.12'
multicast_group
=
'224.12.12.12'
server_address
=
(
''
,
10000
)
server_address
=
(
''
,
10000
)
...
@@ -50,7 +63,7 @@ sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP,
...
@@ -50,7 +63,7 @@ sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP,
# Receive/respond loop
# Receive/respond loop
while
True
:
while
is_running
:
#print >>sys.stderr, '\nwaiting to receive message'
#print >>sys.stderr, '\nwaiting to receive message'
data
,
address
=
sock
.
recvfrom
(
10240
)
data
,
address
=
sock
.
recvfrom
(
10240
)
print
(
data
.
decode
(
"utf-8"
))
print
(
data
.
decode
(
"utf-8"
))
...
...
emulation/client1/root/server.py
View file @
fa26ffa6
...
@@ -3,6 +3,16 @@ import struct
...
@@ -3,6 +3,16 @@ import struct
import
sys
import
sys
import
netifaces
import
netifaces
import
traceback
import
traceback
import
signal
is_running
=
True
sock
=
None
def
exit
(
signal
,
frame
):
is_running
=
False
sock
.
close
()
sys
.
exit
(
0
)
def
chooseInterface
():
def
chooseInterface
():
interfaces
=
netifaces
.
interfaces
()
interfaces
=
netifaces
.
interfaces
()
...
@@ -23,8 +33,9 @@ def chooseInterface():
...
@@ -23,8 +33,9 @@ def chooseInterface():
return
inputValue
return
inputValue
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
#message = 'very important data'
multicast_group
=
(
'224.12.12.12'
,
10000
)
multicast_group
=
(
'224.12.12.12'
,
10000
)
# Create the datagram socket
# Create the datagram socket
...
@@ -42,11 +53,10 @@ ip_interface = netifaces.ifaddresses(interface_name)[netifaces.AF_INET][0]['addr
...
@@ -42,11 +53,10 @@ ip_interface = netifaces.ifaddresses(interface_name)[netifaces.AF_INET][0]['addr
sock
.
bind
((
ip_interface
,
10000
))
sock
.
bind
((
ip_interface
,
10000
))
try
:
try
:
# Look for responses from all recipients
# Look for responses from all recipients
while
True
:
while
is_running
:
input_msg
=
input
(
'msg --> '
)
input_msg
=
input
(
'msg --> '
)
try
:
try
:
sock
.
sendto
(
input_msg
.
encode
(
"utf-8"
),
multicast_group
)
sock
.
sendto
(
input_msg
.
encode
(
"utf-8"
),
multicast_group
)
except
:
except
:
traceback
.
print_exc
()
traceback
.
print_exc
()
continue
continue
...
...
emulation/client2.startup
View file @
fa26ffa6
...
@@ -7,4 +7,4 @@ ip route add 0.0.0.0/0 via 10.0.2.3
...
@@ -7,4 +7,4 @@ ip route add 0.0.0.0/0 via 10.0.2.3
# install python
# install python
apt-get update && apt-get --assume-yes install python3 python3-pip
apt-get update && apt-get --assume-yes install python3 python3-pip
pip-3.2 install netifaces
pip-3.2 install
--index-url=https://pypi.python.org/simple/
netifaces
emulation/client2/root/client.py
View file @
fa26ffa6
...
@@ -2,7 +2,16 @@ import socket
...
@@ -2,7 +2,16 @@ import socket
import
struct
import
struct
import
sys
import
sys
import
netifaces
import
netifaces
import
signal
import
sys
is_running
=
True
sock
=
None
def
exit
(
signal
,
frame
):
is_running
=
False
sock
.
close
()
sys
.
exit
(
0
)
def
chooseInterface
():
def
chooseInterface
():
interfaces
=
netifaces
.
interfaces
()
interfaces
=
netifaces
.
interfaces
()
...
@@ -25,6 +34,10 @@ def chooseInterface():
...
@@ -25,6 +34,10 @@ def chooseInterface():
if
not
hasattr
(
socket
,
'SO_BINDTODEVICE'
):
if
not
hasattr
(
socket
,
'SO_BINDTODEVICE'
):
socket
.
SO_BINDTODEVICE
=
25
socket
.
SO_BINDTODEVICE
=
25
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
multicast_group
=
'224.12.12.12'
multicast_group
=
'224.12.12.12'
server_address
=
(
''
,
10000
)
server_address
=
(
''
,
10000
)
...
@@ -50,7 +63,7 @@ sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP,
...
@@ -50,7 +63,7 @@ sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP,
# Receive/respond loop
# Receive/respond loop
while
True
:
while
is_running
:
#print >>sys.stderr, '\nwaiting to receive message'
#print >>sys.stderr, '\nwaiting to receive message'
data
,
address
=
sock
.
recvfrom
(
10240
)
data
,
address
=
sock
.
recvfrom
(
10240
)
print
(
data
.
decode
(
"utf-8"
))
print
(
data
.
decode
(
"utf-8"
))
...
...
emulation/client2/root/server.py
View file @
fa26ffa6
...
@@ -3,6 +3,16 @@ import struct
...
@@ -3,6 +3,16 @@ import struct
import
sys
import
sys
import
netifaces
import
netifaces
import
traceback
import
traceback
import
signal
is_running
=
True
sock
=
None
def
exit
(
signal
,
frame
):
is_running
=
False
sock
.
close
()
sys
.
exit
(
0
)
def
chooseInterface
():
def
chooseInterface
():
interfaces
=
netifaces
.
interfaces
()
interfaces
=
netifaces
.
interfaces
()
...
@@ -23,8 +33,9 @@ def chooseInterface():
...
@@ -23,8 +33,9 @@ def chooseInterface():
return
inputValue
return
inputValue
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
#message = 'very important data'
multicast_group
=
(
'224.12.12.12'
,
10000
)
multicast_group
=
(
'224.12.12.12'
,
10000
)
# Create the datagram socket
# Create the datagram socket
...
@@ -42,11 +53,10 @@ ip_interface = netifaces.ifaddresses(interface_name)[netifaces.AF_INET][0]['addr
...
@@ -42,11 +53,10 @@ ip_interface = netifaces.ifaddresses(interface_name)[netifaces.AF_INET][0]['addr
sock
.
bind
((
ip_interface
,
10000
))
sock
.
bind
((
ip_interface
,
10000
))
try
:
try
:
# Look for responses from all recipients
# Look for responses from all recipients
while
True
:
while
is_running
:
input_msg
=
input
(
'msg --> '
)
input_msg
=
input
(
'msg --> '
)
try
:
try
:
sock
.
sendto
(
input_msg
.
encode
(
"utf-8"
),
multicast_group
)
sock
.
sendto
(
input_msg
.
encode
(
"utf-8"
),
multicast_group
)
except
:
except
:
traceback
.
print_exc
()
traceback
.
print_exc
()
continue
continue
...
...
emulation/client3.startup
View file @
fa26ffa6
...
@@ -7,4 +7,4 @@ ip route add 0.0.0.0/0 via 10.0.3.4
...
@@ -7,4 +7,4 @@ ip route add 0.0.0.0/0 via 10.0.3.4
# install python
# install python
apt-get update && apt-get --assume-yes install python3 python3-pip
apt-get update && apt-get --assume-yes install python3 python3-pip
pip-3.2 install netifaces
pip-3.2 install
--index-url=https://pypi.python.org/simple/
netifaces
emulation/client3/root/client.py
View file @
fa26ffa6
...
@@ -2,7 +2,16 @@ import socket
...
@@ -2,7 +2,16 @@ import socket
import
struct
import
struct
import
sys
import
sys
import
netifaces
import
netifaces
import
signal
import
sys
is_running
=
True
sock
=
None
def
exit
(
signal
,
frame
):
is_running
=
False
sock
.
close
()
sys
.
exit
(
0
)
def
chooseInterface
():
def
chooseInterface
():
interfaces
=
netifaces
.
interfaces
()
interfaces
=
netifaces
.
interfaces
()
...
@@ -25,6 +34,10 @@ def chooseInterface():
...
@@ -25,6 +34,10 @@ def chooseInterface():
if
not
hasattr
(
socket
,
'SO_BINDTODEVICE'
):
if
not
hasattr
(
socket
,
'SO_BINDTODEVICE'
):
socket
.
SO_BINDTODEVICE
=
25
socket
.
SO_BINDTODEVICE
=
25
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
multicast_group
=
'224.12.12.12'
multicast_group
=
'224.12.12.12'
server_address
=
(
''
,
10000
)
server_address
=
(
''
,
10000
)
...
@@ -50,7 +63,7 @@ sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP,
...
@@ -50,7 +63,7 @@ sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP,
# Receive/respond loop
# Receive/respond loop
while
True
:
while
is_running
:
#print >>sys.stderr, '\nwaiting to receive message'
#print >>sys.stderr, '\nwaiting to receive message'
data
,
address
=
sock
.
recvfrom
(
10240
)
data
,
address
=
sock
.
recvfrom
(
10240
)
print
(
data
.
decode
(
"utf-8"
))
print
(
data
.
decode
(
"utf-8"
))
...
...
emulation/client3/root/server.py
View file @
fa26ffa6
...
@@ -3,6 +3,16 @@ import struct
...
@@ -3,6 +3,16 @@ import struct
import
sys
import
sys
import
netifaces
import
netifaces
import
traceback
import
traceback
import
signal
is_running
=
True
sock
=
None
def
exit
(
signal
,
frame
):
is_running
=
False
sock
.
close
()
sys
.
exit
(
0
)
def
chooseInterface
():
def
chooseInterface
():
interfaces
=
netifaces
.
interfaces
()
interfaces
=
netifaces
.
interfaces
()
...
@@ -23,8 +33,9 @@ def chooseInterface():
...
@@ -23,8 +33,9 @@ def chooseInterface():
return
inputValue
return
inputValue
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
#message = 'very important data'
multicast_group
=
(
'224.12.12.12'
,
10000
)
multicast_group
=
(
'224.12.12.12'
,
10000
)
# Create the datagram socket
# Create the datagram socket
...
@@ -42,11 +53,10 @@ ip_interface = netifaces.ifaddresses(interface_name)[netifaces.AF_INET][0]['addr
...
@@ -42,11 +53,10 @@ ip_interface = netifaces.ifaddresses(interface_name)[netifaces.AF_INET][0]['addr
sock
.
bind
((
ip_interface
,
10000
))
sock
.
bind
((
ip_interface
,
10000
))
try
:
try
:
# Look for responses from all recipients
# Look for responses from all recipients
while
True
:
while
is_running
:
input_msg
=
input
(
'msg --> '
)
input_msg
=
input
(
'msg --> '
)
try
:
try
:
sock
.
sendto
(
input_msg
.
encode
(
"utf-8"
),
multicast_group
)
sock
.
sendto
(
input_msg
.
encode
(
"utf-8"
),
multicast_group
)
except
:
except
:
traceback
.
print_exc
()
traceback
.
print_exc
()
continue
continue
...
...
emulation/router1/root/script.sh
View file @
fa26ffa6
rm
-rf
MulticastRouting/
rm
-rf
MulticastRouting/
cp
-rf
/hosthome/Desktop/pim/ MulticastRouting/
cp
-rf
/hosthome/Desktop/pim/ MulticastRouting/
cd
MulticastRouting
cd
MulticastRouting
pip-3.2
install
-r
requirements.txt
pip-3.2
install
-
-index-url
=
https://pypi.python.org/simple/
-
r
requirements.txt
python3 Run.py
-stop
python3 Run.py
-stop
python3 Run.py
-start
python3 Run.py
-start
...
...
emulation/router2/root/script.sh
View file @
fa26ffa6
rm
-rf
MulticastRouting/
rm
-rf
MulticastRouting/
cp
-rf
/hosthome/Desktop/pim/ MulticastRouting/
cp
-rf
/hosthome/Desktop/pim/ MulticastRouting/
cd
MulticastRouting
cd
MulticastRouting
pip-3.2
install
-r
requirements.txt
pip-3.2
install
-
-index-url
=
https://pypi.python.org/simple/
-
r
requirements.txt
python3 Run.py
-stop
python3 Run.py
-stop
python3 Run.py
-start
python3 Run.py
-start
...
...
emulation/router3/root/script.sh
View file @
fa26ffa6
rm
-rf
MulticastRouting/
rm
-rf
MulticastRouting/
cp
-rf
/hosthome/Desktop/pim/ MulticastRouting/
cp
-rf
/hosthome/Desktop/pim/ MulticastRouting/
cd
MulticastRouting
cd
MulticastRouting
pip-3.2
install
-r
requirements.txt
pip-3.2
install
-
-index-url
=
https://pypi.python.org/simple/
-
r
requirements.txt
python3 Run.py
-stop
python3 Run.py
-stop
python3 Run.py
-start
python3 Run.py
-start
...
...
emulation/router4/root/script.sh
View file @
fa26ffa6
rm
-rf
MulticastRouting/
rm
-rf
MulticastRouting/
cp
-rf
/hosthome/Desktop/pim/ MulticastRouting/
cp
-rf
/hosthome/Desktop/pim/ MulticastRouting/
cd
MulticastRouting
cd
MulticastRouting
pip-3.2
install
-r
requirements.txt
pip-3.2
install
-
-index-url
=
https://pypi.python.org/simple/
-
r
requirements.txt
python3 Run.py
-stop
python3 Run.py
-stop
python3 Run.py
-start
python3 Run.py
-start
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment