WAN, Multicast, Python and how to realise

Hoppert, Kai KHoppert at mbisoftware.de
Tue May 27 02:53:00 EDT 2003


Hi,
 
I tried to realise a Multicast about the Internet but it didn't works. In
Lan it works without problems.
 
Here is the code for client and server.
 
Did anyone have an idea?
 
Server(send)
 
import socket
import time
 
PORT  = 8100
GROUP = '225.0.0.250'
 

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 255)
input="This is a test message"
send = str(time.time())
sock.sendto(send + ' @ ' + input, (GROUP, PORT))
 
 
 
Client(recive)
 
import socket
 
PORT=8100
GROUP='225.0.0.250'
 
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind((socket.gethostname(), PORT))
 
sock.setsockopt(socket.SOL_IP,socket.IP_ADD_MEMBERSHIP,
socket.inet_aton(GROUP)+socket.inet_aton(''))
 
while 1:
 raw, sender = sock.recvfrom(1000)
 print raw
 
 
i tried to run this script with two computers, both sitting behind a dsl
router with a fire wall. Port 8100 was unlocked
 
I think the failure is in binding the local ip adress but how to bind the
externam ip.
 
Greetings
 
Kai

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030527/6e06084d/attachment.html>


More information about the Python-list mailing list