Paul Sijben wrote: > I am stumped by the following problem. I have a large multi-threaded > server accepting communications on one UDP port (chosen for its supposed > speed). > > I have been profiling the code and found that the UDP communication is > my biggest drain on performance! Communication where the client and the > server are on the same machine still takes 300ms or sometimes much more > per packet on an Athlon64 3000+ running Linux (Fedora Core 5 x64). > > I must be doing something wrong and would really appreciate feedback on > my code below: > > I open the server port with > > self.s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) > self.s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) > self.s.bind((myaddress, myport)) > > I then open a client port with > > self.s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM) > self.s.connect((host, port)) > > the client sends data with > > self.s.sendall(data) > > and the server with > > self.s.sendto(data,link.remoteaddress) > > both receive with > > buf, address = socket.recvfrom(8192) > > The sender and receiver are in separate threads (threading.Thread). > > Does anyone know what is going wrong here, the socket communication, the > thread scheduling? > > Paul Sijben >
Is the connection 1:1 i.e. the receiving end receives data only from one sender at the time? And how do you handle lost packages in your application? -- mph -- http://mail.python.org/mailman/listinfo/python-list