Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.4, JRuby 1.5
-
Fix Version/s: None
-
Component/s: Extensions
-
Labels:None
-
Environment:github trunk, Java 6, Mac OS X 10.6.2
-
Number of attachments :
Description
Consider:
aotearoa:~$ ruby -rsocket -e 'p Socket.getservbyname("blp5")'
48129
aotearoa:~$ jruby -rsocket -e 'p Socket.getservbyname("blp5")'
-e:1: no such service blp5/tcp (SocketError)
aotearoa:~$ grep 48129 /etc/services
blp5 48129/tcp # Bloomberg locator
blp5 48129/udp # Bloomberg locator
There is no Java API that can do what getservbyname can do (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071389), so we are currently simply looking up a map in IANA.java. Obviously, this is not a very elegant solution.
Perhaps we can use FFI here.
Given this functionality is probably needed by Jython as well, it could be put in a separate java library.
It could use the native getservent/getservbyname() api if available, else it could fall back to parsing /etc/services, with a final fallback to a hardcoded table as in IANA.java