Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.7.0.pre1
-
Fix Version/s: JRuby 1.7.0.pre2
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:Mac OS X 10.7.4
-
Number of attachments :
Description
In trying to make BERTRPC (https://github.com/mojombo/bertrpc) connections from JRuby, I stumbled on this exception:
NoMethodError: undefined method `recvfrom' for #<Socket:fd>
I don't know much about socket programming, unfortunately, but BERTRPC is doing something like this:
require "socket"
addr = Socket.getaddrinfo("localhost", nil, Socket::AF_INET)
sock = Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0)
sock.connect(Socket.pack_sockaddr_in(8000, addr[0][3]))
sock.recvfrom(123)
On MRI, Socket#recvfrom exists, but on JRuby it does not.
Any help would be appreciated – I hope I'm missing something simple.
(If there's a workaround I could apply to BERTRPC, that would help me a ton in the meantime.)
The problem here is that there's no way in Java for us to match recvfrom behavior for normal TCP sockets. It might be possible for us to add it for datagram sockets, however.
It's also possible that recvfrom can just be an alias for read when doing TCP sockets. Will have to research that a bit.