|
From: Jim B. <jim...@py...> - 2015-11-23 03:24:25
|
John,
I don't believe that the socket.SO_EXCLUSIVEADDRUSE option (which is
exclusive to Windows) is available on Java - not even with Netty, which
sometimes reaches into C/JNI to get at lower-level functionality.
We have mapped socket constants to negative numbers when they are not
supported, per this comment in Lib/_socket.py:
# Options with negative constants are not supported
> # They are being added here so that code that refers to them
> # will not break with an AttributeError
> SO_DEBUG = -1
> SO_DONTROUTE = -1
> SO_EXCLUSIVEADDRUSE = -8
> SO_RCVLOWAT = -16
> SO_RCVTIMEO = -32
> SO_REUSEPORT = -64
> SO_SNDLOWAT = -128
> SO_SNDTIMEO = -256
> SO_USELOOPBACK = -512
This inclusion of constants may incorrectly suggest support, without
knowing about this comment, but removing these constants is a backwards
breaking change.
- Jim
On Sun, Nov 22, 2015 at 4:47 PM, John Hayes <ja...@gm...> wrote:
> Dear all,
>
> I'm trying to use Pyro4 with Jython2.7.0. I've installed both
> 'serpent-1.11' (a Pyro4-dependent serializer) and 'Pyro4-4.40' itself
> seemingly successfully on Windows 7 using 'jython setup.py install' for the
> respective source packages.
>
> However, if I run this simple example of starting a Pyro server:
> > import Pyro4
> >
> > class GreetingMaker(object):
> > def get_fortune(self, name):
> > return "Hello, {0}. Here is your fortune message:\n" \
> > "Behold the warranty -- the bold print giveth and the
> fine print taketh away.".format(name)
> >
> > daemon = Pyro4.Daemon(host="192.168.10.106") # make a
> Pyro daemon
> > uri = daemon.register(GreetingMaker) # register the greeting maker as
> a Pyro object
> >
> > print uri # print the uri so we can use it in the client later
> > daemon.requestLoop() # start the event loop of the
> server to wait for calls
>
> I get the following error:
> > Traceback (most recent call last):
> > File "greeting-server.py", line 8, in <module>
> > daemon = Pyro4.Daemon(host="192.168.10.106") # make a
> Pyro daemon
> > File
> "C:\jython2.7.0\Lib\site-packages\pyro4-4.40-py2.7.egg\Pyro4\core.py", line
> 901, in __init__
> > self.transportServer.init(self, host, port, unixsocket)
> > File
> "C:\jython2.7.0\Lib\site-packages\pyro4-4.40-py2.7.egg\Pyro4\socketserver\threadpoolserver.py",
> line 103, in init
> > self.sock = socketutil.createSocket(bind=bind_location,
> reuseaddr=Pyro4.config.SOCK_REUSE, timeout=Pyro4.config.COMMTIMEOUT,
> noinherit=True, nodelay=Pyro4.config.SOCK_NODELAY)
> > File
> "C:\jython2.7.0\Lib\site-packages\pyro4-4.40-py2.7.egg\Pyro4\socketutil.py",
> line 283, in createSocket
> > bindOnUnusedPort(sock, bind[0])
> > File
> "C:\jython2.7.0\Lib\site-packages\pyro4-4.40-py2.7.egg\Pyro4\socketutil.py",
> line 479, in bindOnUnusedPort
> > sock.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)
> > File "C:\jython2.7.0\Lib\_socket.py", line 1367, in meth
> > return getattr(self._sock,name)(*args)
> > File "C:\jython2.7.0\Lib\_socket.py", line 357, in handle_exception
> > return method_or_function(*args, **kwargs)
> > File "C:\jython2.7.0\Lib\_socket.py", line 357, in handle_exception
> > return method_or_function(*args, **kwargs)
> > File "C:\jython2.7.0\Lib\_socket.py", line 1204, in setsockopt
> > raise error(errno.ENOPROTOOPT, "Protocol not available")
> > _socket.error: [Errno 10042] Protocol not available
>
>
> This seems like a similar problem that someone else was recently having on
> the mailing list that appears rooted in the call to setsockopt:
> http://sourceforge.net/p/jython/mailman/message/34127525/
>
> Is this a bug that has already been reported (I couldn't find it), and/or
> does anyone have any potential ideas for a workaround solution?
>
> I really appreciate any help that can be offered!
>
> All the best,
>
> John
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Jython-users mailing list
> Jyt...@li...
> https://lists.sourceforge.net/lists/listinfo/jython-users
>
|