It doesn't really matter whether its a single dedicated server or a server process on each machine. You have a logical problem with that code. If you use a single attribute and replaces it each time with the new connection, that can cause undefined behavior if two people send messages to the same target. You have slots that expect to read off that single attribute which can be any connection at any time. What if 10 people message the target? And also take note that in your client, using waitForConnected(-1) is an infinitely blocking call. The app will freeze until it succeeds. Best hope the connection never fails.
On Friday, December 28, 2012, PBLNRAO Kiran wrote: > Justin Tanks for your quick reply. > > I figure out the issue, updated in my pastbin link. > > The issue is same as i thought and you also said the same. " replacing > every connection with a new one each time" > > So i added below line after connecting to client so that it waits for my > data to be written. > > "self.Clientsocket.waitForConnected(-1)" and disconnected using > "self.Clientsocket.disconnectFromHost()" instead of > "self.Clientsocket.close()" > > Now this works perfectly. > > I think you thought i am having a server for which clients are connected. > > That's not the situation in my scenario. I made the module in such a > manner we don't require a chat server running on particular system and > connecting all clients to that. > > Here i every system running this module is a server listing for new > connections. > So when i want to sent the message to list of systems. i send it by simply > separating the systems names by (,) using Client class. > > > Hope my approach is right, let me know if i am wrong. > > On Friday, December 28, 2012 12:39:08 PM UTC+5:30, Justin Israel wrote: > > You are replacing every connection with a new one each time so you never > save the previous ones: > > > > > > self.clientConnection = self.tcpServer.nextPendingConnection() > > > > > > > > What you probably want is some data structure to keep them all together: > > > > > > > > client = self.tcpServer.nextPendingConnection() > > self.clientList.append(client) > > > > > > > > On Thursday, December 27, 2012, PBLNRAO Kiran wrote: > > > > I am trying to implement a TCP messaging system in maya. > > > > > > > > Here is my code. Its currently external to maya. > > > > http://pastebin.com/0GpuQhkG > > > > > > > > In this i am able to send message to target system by entering system > name in bottom most line edit. last but one is for message to send. > > > > > > > > When a client receives message a message box will be popped. > > > > > > > > Some times its working and some times its not working. > > > > > > > > I made this modules to send message to multiple systems by entering > systems in systems box separating them with comma (,) > > > > > > > > Here The major issue is, if i have more that 1 system in the systems > list, i am able to send message only for the last person but not for the > remaining. If i type only 1 system then everything is fine. > > > > > > > > Can any one help me how can i solve this issue. > > > > > > > > -- > > > > You received this message because you are subscribed to the Google > Groups "Python Programming for Autodesk Maya" group. > > > > To post to this group, send email to > > [email protected]<javascript:;> > . > > > > To unsubscribe from this group, send email to > [email protected] <javascript:;>. > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To post to this group, send email to > [email protected]<javascript:;> > . > To unsubscribe from this group, send email to > [email protected] <javascript:;>. > > > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected].
