Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 50d5e8a

Browse files
committed
no longer need to include IN.py or SOCKET.py
1 parent 687ec18 commit 50d5e8a

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

Demo/sockets/broadcast.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import sys, time
66
from socket import *
7-
from SOCKET import *
87

98
s = socket(AF_INET, SOCK_DGRAM)
109
s.bind(('', 0))

Demo/sockets/mcast.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
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)
@@ -13,8 +15,6 @@
1315
import struct
1416
import regsub
1517
from socket import *
16-
from SOCKET import *
17-
from IN import * # SGI specific!!! (Sorry)
1818

1919

2020
# Main program
@@ -60,13 +60,10 @@ def receiver():
6060
def 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

Comments
 (0)