The idea is to multicast the same content from one single resource to multiple receivers at once. I came up with the following code:
#!/usr/bin/env python
# coding: utf8
import socket, os
c = socket.socket()
c.connect(('127.1', 4343))
s = socket.socket()
s.bind(('127.1', 8989))
s.listen(3)
while 1:
conn, addr = s.accept()
print 'Connected by %s:%s' % addr
os.dup2(conn.fileno(), c.fileno(), )
s.close()
I tested it with netcat
without any success, either the client
quits unexpected or the server
exits after anything connects. Is this possible at all? What did I do wrong?