Skip to content Skip to sidebar Skip to footer

Corona Simulator Stop Working After Connecting To Server

I have 2 server file work with corona simulator. One is work but another isn't. Not sure what is the different between these 2 file. Below is my server code. Non-working: class Cha

Solution 1:

You need to send "\n" at the end of message

classChat(Protocol):
    defconnectionMade(self):
        self.factory.clients.append(self)
    defconnectionLost(self, reason):
        self.factory.clients.remove(self)
    defdataReceived(self,data):
        for c in self.factory.clients:
            c.message(data)
            print data
    defmessage(self, data):
        self.transport.write(data + '\n')

factory = Factory()
factory.clients = []
factory.protocol = Chat

reactor.listenTCP(8080,factory)
reactor.run()

Its HTTP protocol requirement.

Post a Comment for "Corona Simulator Stop Working After Connecting To Server"