Funny xmlrpc / linux problem

Jeff McNeil jeff at jmcneil.net
Tue Jun 16 13:33:57 EDT 2009


On Jun 16, 12:51 pm, Hans Müller <HeinT... at web.de> wrote:
> Richard,
>
> thanks a lot for your hint, that was completely new for me.
> Nagle's optimisation is definitely a good idea in most cases.
>
> By the way, do you have an idea how to access the underlying socket to modify the behavier
> via the setsockopt function to disable Nagle's algorythm in my special case (i need speed for small
> packets) ?
>
> Thanks a lot
>
> Hans

Something like this ought to work. SimpleXMLRPCServer uses
SocketServer.TCPServer to handle all of the network-layer stuff. Also,
ironically, see http://bugs.python.org/issue6192.

import socket
from SimpleXMLRPCServer import SimpleXMLRPCServer

class MyXMLServer(SimpleXMLRPCServer):
    def server_bind(self):
        self.socket.setsockopt(
            socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
        SimpleXMLRPCServer.server_bind(self)

s = MyXMLServer(('127.0.0.1', 8080))
print s.socket.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY)

HTH,

Jeff



More information about the Python-list mailing list