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
Hide 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
# install python
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
import
struct
import
sys
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
():
interfaces
=
netifaces
.
interfaces
()
...
...
@@ -25,6 +34,10 @@ def chooseInterface():
if
not
hasattr
(
socket
,
'SO_BINDTODEVICE'
):
socket
.
SO_BINDTODEVICE
=
25
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
multicast_group
=
'224.12.12.12'
server_address
=
(
''
,
10000
)
...
...
@@ -50,7 +63,7 @@ sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP,
# Receive/respond loop
while
True
:
while
is_running
:
#print >>sys.stderr, '\nwaiting to receive message'
data
,
address
=
sock
.
recvfrom
(
10240
)
print
(
data
.
decode
(
"utf-8"
))
...
...
emulation/client1/root/server.py
View file @
fa26ffa6
...
...
@@ -3,6 +3,16 @@ import struct
import
sys
import
netifaces
import
traceback
import
signal
is_running
=
True
sock
=
None
def
exit
(
signal
,
frame
):
is_running
=
False
sock
.
close
()
sys
.
exit
(
0
)
def
chooseInterface
():
interfaces
=
netifaces
.
interfaces
()
...
...
@@ -23,8 +33,9 @@ def chooseInterface():
return
inputValue
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
#message = 'very important data'
multicast_group
=
(
'224.12.12.12'
,
10000
)
# Create the datagram socket
...
...
@@ -42,11 +53,10 @@ ip_interface = netifaces.ifaddresses(interface_name)[netifaces.AF_INET][0]['addr
sock
.
bind
((
ip_interface
,
10000
))
try
:
# Look for responses from all recipients
while
True
:
while
is_running
:
input_msg
=
input
(
'msg --> '
)
try
:
sock
.
sendto
(
input_msg
.
encode
(
"utf-8"
),
multicast_group
)
except
:
traceback
.
print_exc
()
continue
...
...
emulation/client2.startup
View file @
fa26ffa6
...
...
@@ -7,4 +7,4 @@ ip route add 0.0.0.0/0 via 10.0.2.3
# install python
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
import
struct
import
sys
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
():
interfaces
=
netifaces
.
interfaces
()
...
...
@@ -25,6 +34,10 @@ def chooseInterface():
if
not
hasattr
(
socket
,
'SO_BINDTODEVICE'
):
socket
.
SO_BINDTODEVICE
=
25
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
multicast_group
=
'224.12.12.12'
server_address
=
(
''
,
10000
)
...
...
@@ -50,7 +63,7 @@ sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP,
# Receive/respond loop
while
True
:
while
is_running
:
#print >>sys.stderr, '\nwaiting to receive message'
data
,
address
=
sock
.
recvfrom
(
10240
)
print
(
data
.
decode
(
"utf-8"
))
...
...
emulation/client2/root/server.py
View file @
fa26ffa6
...
...
@@ -3,6 +3,16 @@ import struct
import
sys
import
netifaces
import
traceback
import
signal
is_running
=
True
sock
=
None
def
exit
(
signal
,
frame
):
is_running
=
False
sock
.
close
()
sys
.
exit
(
0
)
def
chooseInterface
():
interfaces
=
netifaces
.
interfaces
()
...
...
@@ -23,8 +33,9 @@ def chooseInterface():
return
inputValue
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
#message = 'very important data'
multicast_group
=
(
'224.12.12.12'
,
10000
)
# Create the datagram socket
...
...
@@ -42,11 +53,10 @@ ip_interface = netifaces.ifaddresses(interface_name)[netifaces.AF_INET][0]['addr
sock
.
bind
((
ip_interface
,
10000
))
try
:
# Look for responses from all recipients
while
True
:
while
is_running
:
input_msg
=
input
(
'msg --> '
)
try
:
sock
.
sendto
(
input_msg
.
encode
(
"utf-8"
),
multicast_group
)
except
:
traceback
.
print_exc
()
continue
...
...
emulation/client3.startup
View file @
fa26ffa6
...
...
@@ -7,4 +7,4 @@ ip route add 0.0.0.0/0 via 10.0.3.4
# install python
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
import
struct
import
sys
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
():
interfaces
=
netifaces
.
interfaces
()
...
...
@@ -25,6 +34,10 @@ def chooseInterface():
if
not
hasattr
(
socket
,
'SO_BINDTODEVICE'
):
socket
.
SO_BINDTODEVICE
=
25
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
multicast_group
=
'224.12.12.12'
server_address
=
(
''
,
10000
)
...
...
@@ -50,7 +63,7 @@ sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP,
# Receive/respond loop
while
True
:
while
is_running
:
#print >>sys.stderr, '\nwaiting to receive message'
data
,
address
=
sock
.
recvfrom
(
10240
)
print
(
data
.
decode
(
"utf-8"
))
...
...
emulation/client3/root/server.py
View file @
fa26ffa6
...
...
@@ -3,6 +3,16 @@ import struct
import
sys
import
netifaces
import
traceback
import
signal
is_running
=
True
sock
=
None
def
exit
(
signal
,
frame
):
is_running
=
False
sock
.
close
()
sys
.
exit
(
0
)
def
chooseInterface
():
interfaces
=
netifaces
.
interfaces
()
...
...
@@ -23,8 +33,9 @@ def chooseInterface():
return
inputValue
signal
.
signal
(
signal
.
SIGINT
,
exit
)
signal
.
signal
(
signal
.
SIGTERM
,
exit
)
#message = 'very important data'
multicast_group
=
(
'224.12.12.12'
,
10000
)
# Create the datagram socket
...
...
@@ -42,11 +53,10 @@ ip_interface = netifaces.ifaddresses(interface_name)[netifaces.AF_INET][0]['addr
sock
.
bind
((
ip_interface
,
10000
))
try
:
# Look for responses from all recipients
while
True
:
while
is_running
:
input_msg
=
input
(
'msg --> '
)
try
:
sock
.
sendto
(
input_msg
.
encode
(
"utf-8"
),
multicast_group
)
except
:
traceback
.
print_exc
()
continue
...
...
emulation/router1/root/script.sh
View file @
fa26ffa6
rm
-rf
MulticastRouting/
cp
-rf
/hosthome/Desktop/pim/ 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
-start
...
...
emulation/router2/root/script.sh
View file @
fa26ffa6
rm
-rf
MulticastRouting/
cp
-rf
/hosthome/Desktop/pim/ 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
-start
...
...
emulation/router3/root/script.sh
View file @
fa26ffa6
rm
-rf
MulticastRouting/
cp
-rf
/hosthome/Desktop/pim/ 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
-start
...
...
emulation/router4/root/script.sh
View file @
fa26ffa6
rm
-rf
MulticastRouting/
cp
-rf
/hosthome/Desktop/pim/ 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
-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