Corona Simulator stop working after connecting to the 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:

from twisted.internet.protocol import Factory,Protocol from twisted.internet import reactor class Chat(Protocol): def connectionMade(self): self.factory.clients.append(self) def connectionLost(self, reason): self.factory.clients.remove(self) def dataReceived(self,data): for c in self.factory.clients: c.message(data) print data def message(self, data): self.transport.write(data) factory = Factory() factory.clients = [] factory.protocol = Chat reactor.listenTCP(8080,factory) reactor.run()

Working server (I think it’s the same as not-working one above)

from twisted.internet.protocol import Factory, Protocol from twisted.internet import reactor class IphoneChat(Protocol): def connectionMade(self): self.factory.clients.append(self) print "Clients are " ,self.factory.clients def connectionLost(self, reason): self.factory.clients.remove(self) def dataReceived(self, data): print "The data is " ,data for c in self.factory.clients: c.message(data) def message(self, message): self.transport.write(message + '\n') factory = Factory() factory.clients = [] factory.protocol = IphoneChat reactor.listenTCP(8080, factory) print "Server Start!!!" reactor.run()

Thank you for incoming help.