1- # Send/receive UDP multicast packets (SGI)
2- # After /usr/people/4Dgifts/examples/network/mcast.c
1+ # Send/receive UDP multicast packets.
2+ # Requires that your OS kernel supports IP multicast.
3+ # This is built-in on SGI, still optional for most other vendors.
4+ #
35# Usage:
46# mcast -s (sender)
57# mcast -b (sender, using broadcast instead multicast)
1315import struct
1416import regsub
1517from socket import *
16- from SOCKET import *
17- from IN import * # SGI specific!!! (Sorry)
1818
1919
2020# Main program
@@ -60,13 +60,10 @@ def receiver():
6060def openmcastsock (group , port ):
6161 # Import modules used only here
6262 import regsub
63- import socket
6463 import struct
65- from SOCKET import *
66- from IN import *
6764 #
6865 # Create a socket
69- s = socket . socket (AF_INET , SOCK_DGRAM )
66+ s = socket (AF_INET , SOCK_DGRAM )
7067 #
7168 # Allow multiple copies of this program on one machine
7269 # (not strictly needed)
@@ -77,7 +74,7 @@ def openmcastsock(group, port):
7774 #
7875 # Look up multicast group address in name server
7976 # (doesn't hurt if it is already in ddd.ddd.ddd.ddd format)
80- group = socket . gethostbyname (group )
77+ group = gethostbyname (group )
8178 #
8279 # Construct binary group address
8380 bytes = eval (regsub .gsub ('\.' , ',' , group ))
0 commit comments