Top Fields Constructors Methods
org.jruby.ext.socket

public Class RubySocket

extends RubyBasicSocket
Class Inheritance
Known Direct Subclasses
org.jruby.ext.socket.RubyServerSocket
Annotations
@JRubyClass
name:Socket
parent:BasicSocket
include:Socket::Constants
Imports
jnr.constants.platform.AddressFamily, .AddressInfo, .Errno, .INAddr, .IP, .IPProto, .NameInfo, .ProtocolFamily, .Shutdown, .Sock, .SocketLevel, .SocketMessage, .SocketOption, .TCP, .InterfaceInfo, jnr.netdb.Protocol, jnr.unixsocket.UnixSocketAddress, .UnixSocketChannel, org.jruby.Ruby, .RubyBoolean, .RubyClass, .RubyFixnum, .RubyModule, org.jruby.anno.JRubyClass, .JRubyMethod, org.jruby.api.Access, .Convert, .Create, org.jruby.exceptions.RaiseException, org.jruby.runtime.Arity, .Helpers, .ThreadContext, .Visibility, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.io.ChannelFD, .Sockaddr, java.io.IOException, java.net.DatagramSocket, .InetSocketAddress, .InterfaceAddress, .NetworkInterface, .Socket, .SocketAddress, .SocketException, .UnknownHostException, java.nio.channels.AlreadyConnectedException, .Channel, .ClosedChannelException, .ConnectionPendingException, .DatagramChannel, .SelectableChannel, .SelectionKey, .SocketChannel, java.util.Enumeration, java.util.regex.Pattern

Field Summary

Modifier and TypeField and Description
private static final Pattern
private static final Pattern
private static final String
protected AddressFamily
protected Protocol
protected ProtocolFamily
protected Sock
Inherited from org.jruby.ext.socket.RubyBasicSocket:
libnamesmulticastStateManagerSOCKOPT

Constructor Summary

AccessConstructor and Description
public
RubySocket(Ruby runtime, RubyClass type)

Method Summary

Modifier and TypeMethod and Description
public IRubyObject
public IRubyObject
private SocketAddress
protected IRubyObject
public IRubyObject
pack-priv static RaiseException
buildSocketException(final Ruby runtime, final SocketException ex, final String caller, final SocketAddress addr)

public IRubyObject
close(final ThreadContext context)

Overrides org.jruby.RubyIO.close.

Closes all open resources for the IO.

public RubyBoolean
public IRubyObject
public IRubyObject
public IRubyObject
pack-priv static RubyClass
createSocket(ThreadContext context, RubyClass BasicSocket)

protected void
protected IRubyObject
doConnect(ThreadContext context, SocketAddress addr, boolean ex)

private IRubyObject
doConnectNonblock(ThreadContext context, SocketAddress addr, boolean ex)

public static IRubyObject
private static CharSequence
public static IRubyObject
private static RubyBoolean
public static IRubyObject
public static IRubyObject
public static IRubyObject
public static IRubyObject
public static IRubyObject
public static IRubyObject
protected SocketAddress
protected ChannelFD
private void
private void
private void
protected void
initFromServer(Ruby runtime, RubySocket serverSocket, SocketChannel socketChannel)

public IRubyObject
public IRubyObject
initialize(ThreadContext context, IRubyObject domain, IRubyObject type, IRubyObject protocol)

public static IRubyObject
public IRubyObject
listen(ThreadContext context, IRubyObject backlog)

public static IRubyObject
public static IRubyObject
public IRubyObject
public IRubyObject
recvfrom(ThreadContext context, IRubyObject _length, IRubyObject _flags)

Overrides IPSocket#recvfrom

public IRubyObject
private void
private void
private void
public static RuntimeException
sockerr(Ruby runtime, String msg)
Deprecated

public static IRubyObject
socketpair(ThreadContext context, IRubyObject recv, IRubyObject domain, IRubyObject type, IRubyObject protocol)

public static IRubyObject
public static IRubyObject
public static IRubyObject
private boolean
tryConnect(ThreadContext context, Channel channel, SocketAddress addr, boolean ex, boolean blocking)

public static IRubyObject
public static IRubyObject
Inherited from org.jruby.ext.socket.RubyBasicSocket:
asBooleanbindContextMessagebindContextMessageclose_readclose_writecreateBasicSocketdo_not_reverse_lookupdo_not_reverse_lookupdo_not_reverse_lookupdoNotReverseLookupdoReaddoReadNonblockextractExceptionArggetInetRemoteSocketgetInetRemoteSocketgetInetSocketAddressgetpeereidgetpeernamegetpeernamegetRemoteSocketgetRemoteSocketgetsocknamegetsocknamegetSocknameCommongetsockoptgetsockoptgetUnixRemoteSocketgetUnixRemoteSocketgetUnixSocketAddressinitSocketlocal_addressnewChannelFDread_nonblockread_nonblockread_nonblockread_nonblockrecvrecvrecvrecv_nonblockrecvmsgrecvmsg_nonblockremote_addresssendsendsendmsgsendmsg_nonblockset_do_not_reverse_lookupset_do_not_reverse_lookupset_do_not_reverse_lookupsetsockoptsetsockoptsetsockoptshutdownsockerr

Field Detail

ADDR_NOT_AVAIL_PATTERNback to summary
private static final Pattern ADDR_NOT_AVAIL_PATTERN
ALREADY_BOUND_PATTERNback to summary
private static final Pattern ALREADY_BOUND_PATTERN
JRUBY_SERVER_SOCKET_ERRORback to summary
private static final String JRUBY_SERVER_SOCKET_ERROR
soDomainback to summary
protected AddressFamily soDomain
soProtocolback to summary
protected Protocol soProtocol
soProtocolFamilyback to summary
protected ProtocolFamily soProtocolFamily
soTypeback to summary
protected Sock soType

Constructor Detail

RubySocketback to summary
public RubySocket(Ruby runtime, RubyClass type)

Method Detail

acceptback to summary
public IRubyObject accept(ThreadContext context)
Annotations
@JRubyMethod
notImplemented:true
accept_nonblockback to summary
public IRubyObject accept_nonblock(ThreadContext context, IRubyObject[] args)
Annotations
@JRubyMethod
notImplemented:true
optional:1
checkArity:false
addressForChannelback to summary
private SocketAddress addressForChannel(ThreadContext context, IRubyObject arg)
addrForback to summary
protected IRubyObject addrFor(ThreadContext context, InetSocketAddress addr, boolean reverse)

Overrides org.jruby.ext.socket.RubyBasicSocket.addrFor.

Annotations
@Override
bindback to summary
public IRubyObject bind(ThreadContext context, IRubyObject arg)
Annotations
@JRubyMethod
buildSocketExceptionback to summary
pack-priv static RaiseException buildSocketException(final Ruby runtime, final SocketException ex, final String caller, final SocketAddress addr)
closeback to summary
public IRubyObject close(final ThreadContext context)

Overrides org.jruby.RubyIO.close.

Doc from org.jruby.RubyIO.close.

Closes all open resources for the IO. It also removes it from our magical all open file descriptor pool.

Returns:IRubyObject

The IO. Returns nil if the IO was already closed. MRI: rb_io_close_m

Annotations
@Override
@JRubyMethod
closed_pback to summary
public RubyBoolean closed_p(ThreadContext context)

Overrides org.jruby.RubyIO.closed_p.

Annotations
@Override
connectback to summary
public IRubyObject connect(ThreadContext context, IRubyObject arg)
Annotations
@JRubyMethod
connect_nonblockback to summary
public IRubyObject connect_nonblock(ThreadContext context, IRubyObject arg)
Annotations
@JRubyMethod
connect_nonblockback to summary
public IRubyObject connect_nonblock(ThreadContext context, IRubyObject arg, IRubyObject opts)
Annotations
@JRubyMethod
createSocketback to summary
pack-priv static RubyClass createSocket(ThreadContext context, RubyClass BasicSocket)
doBindback to summary
protected void doBind(ThreadContext context, SocketAddress iaddr)
doConnectback to summary
protected IRubyObject doConnect(ThreadContext context, SocketAddress addr, boolean ex)
doConnectNonblockback to summary
private IRubyObject doConnectNonblock(ThreadContext context, SocketAddress addr, boolean ex)
for_fdback to summary
public static IRubyObject for_fd(ThreadContext context, IRubyObject socketClass, IRubyObject _fd)

Hides org.jruby.ext.socket.RubyBasicSocket.for_fd.

Annotations
@JRubyMethod
meta:true
formatAddressback to summary
private static CharSequence formatAddress(final SocketAddress addr)
getaddrinfoback to summary
public static IRubyObject getaddrinfo(ThreadContext context, IRubyObject recv, IRubyObject[] args)
Annotations
@JRubyMethod
required:2
optional:5
checkArity:false
meta:true
getFastFallbackDefaultback to summary
private static RubyBoolean getFastFallbackDefault(ThreadContext context)
gethostbyaddrback to summary
public static IRubyObject gethostbyaddr(ThreadContext context, IRubyObject recv, IRubyObject[] args)
Annotations
@JRubyMethod
required:1
rest:true
checkArity:false
meta:true
gethostbynameback to summary
public static IRubyObject gethostbyname(ThreadContext context, IRubyObject recv, IRubyObject hostname)
Annotations
@JRubyMethod
meta:true
gethostnameback to summary
public static IRubyObject gethostname(ThreadContext context, IRubyObject recv)
Annotations
@JRubyMethod
meta:true
getifaddrsback to summary
public static IRubyObject getifaddrs(ThreadContext context, IRubyObject recv)
Annotations
@JRubyMethod
meta:true
getnameinfoback to summary
public static IRubyObject getnameinfo(ThreadContext context, IRubyObject recv, IRubyObject[] args)
Annotations
@JRubyMethod
required:1
optional:1
checkArity:false
meta:true
getservbynameback to summary
public static IRubyObject getservbyname(ThreadContext context, IRubyObject recv, IRubyObject[] args)
Annotations
@JRubyMethod
required:1
optional:1
checkArity:false
meta:true
getSocketAddressback to summary
protected SocketAddress getSocketAddress()

Overrides org.jruby.ext.socket.RubyBasicSocket.getSocketAddress.

initChannelFDback to summary
protected ChannelFD initChannelFD(Ruby runtime)
initFieldsFromDescriptorback to summary
private void initFieldsFromDescriptor(Ruby runtime, ChannelFD fd)
initFromArgsback to summary
private void initFromArgs(ThreadContext context, IRubyObject domain, IRubyObject type, IRubyObject protocol)
initFromArgsback to summary
private void initFromArgs(ThreadContext context, IRubyObject domain, IRubyObject type)
initFromServerback to summary
protected void initFromServer(Ruby runtime, RubySocket serverSocket, SocketChannel socketChannel)
initializeback to summary
public IRubyObject initialize(ThreadContext context, IRubyObject domain, IRubyObject type)
Annotations
@JRubyMethod
name:initialize
visibility:PRIVATE
initializeback to summary
public IRubyObject initialize(ThreadContext context, IRubyObject domain, IRubyObject type, IRubyObject protocol)
Annotations
@JRubyMethod
name:initialize
visibility:PRIVATE
ip_address_listback to summary
public static IRubyObject ip_address_list(ThreadContext context, IRubyObject self)
Annotations
@JRubyMethod
meta:true
listenback to summary
public IRubyObject listen(ThreadContext context, IRubyObject backlog)
Annotations
@JRubyMethod
notImplemented:true
pack_sockaddr_inback to summary
public static IRubyObject pack_sockaddr_in(ThreadContext context, IRubyObject recv, IRubyObject port, IRubyObject host)
Annotations
@JRubyMethod
name:pack_sockaddr_in, sockaddr_in
meta:true
pack_sockaddr_unback to summary
public static IRubyObject pack_sockaddr_un(ThreadContext context, IRubyObject recv, IRubyObject filename)
Annotations
@JRubyMethod
name:pack_sockaddr_un, sockaddr_un
meta:true
recvfromback to summary
public IRubyObject recvfrom(ThreadContext context, IRubyObject _length)
Annotations
@JRubyMethod
recvfromback to summary
public IRubyObject recvfrom(ThreadContext context, IRubyObject _length, IRubyObject _flags)

Overrides IPSocket#recvfrom

Annotations
@JRubyMethod
recvfrom_nonblockback to summary
public IRubyObject recvfrom_nonblock(ThreadContext context, IRubyObject[] args)
Annotations
@JRubyMethod
required:1
optional:3
checkArity:false
setDomainback to summary
private void setDomain(ThreadContext context, IRubyObject domain)
setProtocolback to summary
private void setProtocol(ThreadContext context, IRubyObject protocol)
setTypeback to summary
private void setType(ThreadContext context, IRubyObject type)
sockerrback to summary
public static RuntimeException sockerr(Ruby runtime, String msg)

Deprecated

Annotations
@Deprecated
socketpairback to summary
public static IRubyObject socketpair(ThreadContext context, IRubyObject recv, IRubyObject domain, IRubyObject type, IRubyObject protocol)
Annotations
@JRubyMethod
name:socketpair, pair
meta:true
socketpairback to summary
public static IRubyObject socketpair(ThreadContext context, IRubyObject recv, IRubyObject domain, IRubyObject type)
Annotations
@JRubyMethod
name:socketpair, pair
meta:true
tcp_fast_fallbackback to summary
public static IRubyObject tcp_fast_fallback(ThreadContext context, IRubyObject self)
Annotations
@JRubyMethod
meta:true
tcp_fast_fallback_setback to summary
public static IRubyObject tcp_fast_fallback_set(ThreadContext context, IRubyObject self, IRubyObject value)
Annotations
@JRubyMethod
name:tcp_fast_fallback=
meta:true
tryConnectback to summary
private boolean tryConnect(ThreadContext context, Channel channel, SocketAddress addr, boolean ex, boolean blocking)
unpack_sockaddr_inback to summary
public static IRubyObject unpack_sockaddr_in(ThreadContext context, IRubyObject recv, IRubyObject addr)
Annotations
@JRubyMethod
meta:true
unpack_sockaddr_unback to summary
public static IRubyObject unpack_sockaddr_un(ThreadContext context, IRubyObject recv, IRubyObject addr)
Annotations
@JRubyMethod
meta:true