-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsenderB.py
More file actions
30 lines (19 loc) · 815 Bytes
/
Copy pathsenderB.py
File metadata and controls
30 lines (19 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#Sender B
import grouplib as gl
import time
import os
ipaddr = '192.168.2.9'
#ipaddr, port = input(' Sender B started\nGive IP & port of directory (with whitespaces in between): \n').split()
port = input(' Sender B started\nGive port of directory (with whitespaces in between): \n')
gl.grp_setdir(ipaddr, port)
gName, multicastIP, multicastPort, myID = input(' Sender B: Give group name, multicastIP, multicastPort and your ID (with whitespaces in between): \n').split()
gsocket = gl.grp_join(gName, multicastIP, multicastPort, myID)
if gsocket == -1:
print('ERROR: Sender B joined group!')
time.sleep(15)
gl.grp_send(gsocket, "hi", 4)
time.sleep(30)
print(' Sender B is leaving group...')
ret = gl.grp_leave(gsocket)
if ret == -1:
print('ERROR: Sender B left group!')