Last active
April 8, 2016 19:45
-
-
Save abhigenie92/19d5ab69bf30b108f031956cee88f220 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from twisted.internet.protocol import Protocol, Factory | |
class AudioEcho(Protocol): | |
def __init__(self, factory): | |
self.factory = factory | |
def connectionMade(self): | |
print "Connected client:",self | |
self.factory.echoers.append(self) | |
def dataReceived(self, data): | |
for echoer in self.factory.echoers: | |
if echoer!=self: | |
print "sent data" | |
echoer.transport.write(data) | |
def connectionLost(self, reason): | |
self.factory.echoers.remove(self) | |
class AudioEchoFactory(Factory): | |
def __init__(self,server_room): | |
self.echoers = [] | |
self.server_room=server_room | |
def buildProtocol(self, addr): | |
return AudioEcho(self) | |
Server log: | |
2016-04-09 01:13:52+0530 [-] Connected client: <stroke_protocol.StrokeEcho instance at 0x00000000050C7108> | |
2016-04-09 01:13:52+0530 [-] Connected client: <audio_protocol.AudioEcho instance at 0x00000000050D4448> | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:52+0530 [-] sent data | |
2016-04-09 01:13:53+0530 [-] sent data | |
2016-04-09 01:13:53+0530 [-] sent data | |
2016-04-09 01:13:53+0530 [-] sent data | |
2016-04-09 01:13:53+0530 [-] sent data | |
2016-04-09 01:13:53+0530 [-] sent data | |
2016-04-09 01:13:53+0530 [-] sent data | |
2016-04-09 01:13:53+0530 [-] sent data | |
2016-04-09 01:13:53+0530 [-] sent data | |
2016-04-09 01:13:53+0530 [-] sent data | |
2016-04-09 01:13:53+0530 [-] sent data | |
2016-04-09 01:13:53+0530 [-] Audio client disconnected: <audio_protocol.AudioEcho instance at 0x00000000050D4448> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment