summaryrefslogtreecommitdiffstats
path: root/Demo/sockets
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-03-04 22:57:56 (GMT)
committerGuido van Rossum <guido@python.org>1995-03-04 22:57:56 (GMT)
commit50d5e8a23a6e7d3da39009218c3f5b2b2afd1df9 (patch)
tree72c4cded9a4eba07d1cca21da8910d0e26c68c53 /Demo/sockets
parent687ec1892b60c4e57575f823cf0c6e49ae21afaf (diff)
downloadcpython-50d5e8a23a6e7d3da39009218c3f5b2b2afd1df9.zip
cpython-50d5e8a23a6e7d3da39009218c3f5b2b2afd1df9.tar.gz
cpython-50d5e8a23a6e7d3da39009218c3f5b2b2afd1df9.tar.bz2
no longer need to include IN.py or SOCKET.py
Diffstat (limited to 'Demo/sockets')
-rwxr-xr-xDemo/sockets/broadcast.py1
-rwxr-xr-xDemo/sockets/mcast.py15
2 files changed, 6 insertions, 10 deletions
diff --git a/Demo/sockets/broadcast.py b/Demo/sockets/broadcast.py
index 4b30143..a02b081 100755
--- a/Demo/sockets/broadcast.py
+++ b/Demo/sockets/broadcast.py
@@ -4,7 +4,6 @@ MYPORT = 50000
import sys, time
from socket import *
-from SOCKET import *
s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 0))
diff --git a/Demo/sockets/mcast.py b/Demo/sockets/mcast.py
index 8c6298e..4cd8706 100755
--- a/Demo/sockets/mcast.py
+++ b/Demo/sockets/mcast.py
@@ -1,5 +1,7 @@
-# Send/receive UDP multicast packets (SGI)
-# After /usr/people/4Dgifts/examples/network/mcast.c
+# Send/receive UDP multicast packets.
+# Requires that your OS kernel supports IP multicast.
+# This is built-in on SGI, still optional for most other vendors.
+#
# Usage:
# mcast -s (sender)
# mcast -b (sender, using broadcast instead multicast)
@@ -13,8 +15,6 @@ import time
import struct
import regsub
from socket import *
-from SOCKET import *
-from IN import * # SGI specific!!! (Sorry)
# Main program
@@ -60,13 +60,10 @@ def receiver():
def openmcastsock(group, port):
# Import modules used only here
import regsub
- import socket
import struct
- from SOCKET import *
- from IN import *
#
# Create a socket
- s = socket.socket(AF_INET, SOCK_DGRAM)
+ s = socket(AF_INET, SOCK_DGRAM)
#
# Allow multiple copies of this program on one machine
# (not strictly needed)
@@ -77,7 +74,7 @@ def openmcastsock(group, port):
#
# Look up multicast group address in name server
# (doesn't hurt if it is already in ddd.ddd.ddd.ddd format)
- group = socket.gethostbyname(group)
+ group = gethostbyname(group)
#
# Construct binary group address
bytes = eval(regsub.gsub('\.', ',', group))