Created on 2011-07-07.17:32:11 by firstname.lastname@example.org, last changed 2011-11-02.23:22:25 by amak.
|msg6563 (view)||Author: Quanah Gibson-Mount (email@example.com)||Date: 2011-07-07.17:32:11|
It would be very useful to be able to use unix sockets out of the box with Jython, as this would model the behavior of Python, and easily allow the ability to do things like log to unix sockets with Syslog.
|msg6694 (view)||Author: Alan Kennedy (amak)||Date: 2011-11-02.23:21:33|
From jython-dev@ [Quanah] > Has anyone gotten jython to work with unix sockets, as python does? > It doesn't seem to support this basic feature. :/ Java does not support unix-domain sockets because it is not a portable concept, e.g. it can't be supported on Windows, which doesn't have unix domain sokets. (Although it does have a related concept, named pipes, which uses a Windows-specific API, and different semantics). [Quanah] > I would note there exist java-based packages (such as Junixsocket) to do > this, I was expecting jython would support it for python compatibility. We do our best to make jython compatible with cpython. But there are some cases where it is not possible, because the support simply is not there on the JVM. Another area where this is true is TIPC. http://tipc.sourceforge.net/ http://docs.python.org/library/socket.html [Quanah] > Unfortunately the socket bits shipped in the Jython jar don't seem to > allow for this. In order to use junixsocket for jython sockets, junixsocket would have to be rewritten (both the C and java components of it) to support asynchronous/non-blocking IO. Unlike the rest of the jython socket implementation, junixsocket does not support asynchronous IO, meaning that it is not possible to use event driven programming with it. http://code.google.com/p/junixsocket/wiki/ToDo The ease of event driven programming in python is one of the fundamental reasons why people choose the language as a platform for writing high-performance event driven servers such as twisted or tornado. So, while it is possible to implement support for something like junixsocket in the jython socket module, it would only work on platforms where junixsocket works. Also it would quickly lead to complaints about it not supporting asynchronous IO, which would require a massive effort to fix. The existing jython IO layer is heavily dependent on java.nio APIs (which is part of the reason why jython IO is so performant). http://hg.python.org/jython/file/704b07c1d5f5/src/org/python/core/io [Pierre] > Why can't you use Junixsocket? > > Python (CPython) is extensible using extension or c-extension. To do the same > thing with Java (Jython), you have to use Java Native Interface (JNI). Then you > can use these Java API from Jython just like any Java API. Directly using junixsocket from jython would be even easier than that, since the JNI bits are already implemented. All that would be required is to A: Follow the junixsocket instructions on importing the JNI component, and B: import the library and coding against it's java API. http://code.google.com/p/junixsocket/wiki/GettingStarted Alan.
|msg6695 (view)||Author: Alan Kennedy (amak)||Date: 2011-11-02.23:22:25|
Closing this issue.
|2011-11-02 23:22:25||amak||set||status: open -> closed|
resolution: wont fix
messages: + msg6695
|2011-11-02 23:21:33||amak||set||assignee: amak|
messages: + msg6694
nosy: + amak