PageRenderTime 69ms CodeModel.GetById 28ms RepoModel.GetById 14ms app.codeStats 0ms

/projects/jruby-1.7.3/src/org/jruby/ext/socket/RubySocket.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus
Java | 605 lines | 427 code | 135 blank | 43 comment | 61 complexity | 05c596030bc6143d2e21cf4533b7d95f MD5 | raw file
  1. /***** BEGIN LICENSE BLOCK *****
  2. * Version: EPL 1.0/GPL 2.0/LGPL 2.1
  3. *
  4. * The contents of this file are subject to the Common Public
  5. * License Version 1.0 (the "License"); you may not use this file
  6. * except in compliance with the License. You may obtain a copy of
  7. * the License at http://www.eclipse.org/legal/cpl-v10.html
  8. *
  9. * Software distributed under the License is distributed on an "AS
  10. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  11. * implied. See the License for the specific language governing
  12. * rights and limitations under the License.
  13. *
  14. * Copyright (C) 2007 Ola Bini <ola@ologix.com>
  15. *
  16. * Alternatively, the contents of this file may be used under the terms of
  17. * either of the GNU General Public License Version 2 or later (the "GPL"),
  18. * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  19. * in which case the provisions of the GPL or the LGPL are applicable instead
  20. * of those above. If you wish to allow use of your version of this file only
  21. * under the terms of either the GPL or the LGPL, and not to allow others to
  22. * use your version of this file under the terms of the EPL, indicate your
  23. * decision by deleting the provisions above and replace them with the notice
  24. * and other provisions required by the GPL or the LGPL. If you do not delete
  25. * the provisions above, a recipient may use your version of this file under
  26. * the terms of any one of the EPL, the GPL or the LGPL.
  27. ***** END LICENSE BLOCK *****/
  28. package org.jruby.ext.socket;
  29. import jnr.constants.platform.AddressFamily;
  30. import jnr.constants.platform.INAddr;
  31. import jnr.constants.platform.IPProto;
  32. import jnr.constants.platform.NameInfo;
  33. import jnr.constants.platform.ProtocolFamily;
  34. import jnr.constants.platform.Shutdown;
  35. import jnr.constants.platform.Sock;
  36. import jnr.constants.platform.SocketLevel;
  37. import jnr.constants.platform.SocketOption;
  38. import jnr.constants.platform.TCP;
  39. import jnr.unixsocket.UnixSocketAddress;
  40. import jnr.unixsocket.UnixSocketChannel;
  41. import org.jruby.CompatVersion;
  42. import org.jruby.Ruby;
  43. import org.jruby.RubyClass;
  44. import org.jruby.RubyFixnum;
  45. import org.jruby.RubyModule;
  46. import org.jruby.anno.JRubyClass;
  47. import org.jruby.anno.JRubyMethod;
  48. import org.jruby.exceptions.RaiseException;
  49. import org.jruby.runtime.ObjectAllocator;
  50. import org.jruby.runtime.ThreadContext;
  51. import org.jruby.runtime.builtin.IRubyObject;
  52. import org.jruby.util.io.ChannelDescriptor;
  53. import org.jruby.util.io.ModeFlags;
  54. import org.jruby.util.io.Sockaddr;
  55. import java.io.IOException;
  56. import java.net.DatagramSocket;
  57. import java.net.InetSocketAddress;
  58. import java.net.Socket;
  59. import java.net.SocketAddress;
  60. import java.net.SocketException;
  61. import java.net.UnknownHostException;
  62. import java.nio.channels.AlreadyConnectedException;
  63. import java.nio.channels.Channel;
  64. import java.nio.channels.ClosedChannelException;
  65. import java.nio.channels.ConnectionPendingException;
  66. import java.nio.channels.DatagramChannel;
  67. import java.nio.channels.SelectableChannel;
  68. import java.nio.channels.SocketChannel;
  69. import java.util.regex.Pattern;
  70. /**
  71. * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
  72. */
  73. @JRubyClass(name="Socket", parent="BasicSocket", include="Socket::Constants")
  74. public class RubySocket extends RubyBasicSocket {
  75. static void createSocket(Ruby runtime) {
  76. RubyClass rb_cSocket = runtime.defineClass("Socket", runtime.getClass("BasicSocket"), SOCKET_ALLOCATOR);
  77. RubyModule rb_mConstants = rb_cSocket.defineModuleUnder("Constants");
  78. // we don't have to define any that we don't support; see socket.c
  79. runtime.loadConstantSet(rb_mConstants, Sock.class);
  80. runtime.loadConstantSet(rb_mConstants, SocketOption.class);
  81. runtime.loadConstantSet(rb_mConstants, SocketLevel.class);
  82. runtime.loadConstantSet(rb_mConstants, ProtocolFamily.class);
  83. runtime.loadConstantSet(rb_mConstants, AddressFamily.class);
  84. runtime.loadConstantSet(rb_mConstants, INAddr.class);
  85. runtime.loadConstantSet(rb_mConstants, IPProto.class);
  86. runtime.loadConstantSet(rb_mConstants, Shutdown.class);
  87. runtime.loadConstantSet(rb_mConstants, TCP.class);
  88. runtime.loadConstantSet(rb_mConstants, NameInfo.class);
  89. // mandatory constants we haven't implemented
  90. rb_mConstants.setConstant("MSG_OOB", runtime.newFixnum(MSG_OOB));
  91. rb_mConstants.setConstant("MSG_PEEK", runtime.newFixnum(MSG_PEEK));
  92. rb_mConstants.setConstant("MSG_DONTROUTE", runtime.newFixnum(MSG_DONTROUTE));
  93. rb_mConstants.setConstant("MSG_WAITALL", runtime.newFixnum(MSG_WAITALL));
  94. // constants webrick crashes without
  95. rb_mConstants.setConstant("AI_PASSIVE", runtime.newFixnum(1));
  96. // More constants needed by specs
  97. rb_mConstants.setConstant("IP_MULTICAST_TTL", runtime.newFixnum(10));
  98. rb_mConstants.setConstant("IP_MULTICAST_LOOP", runtime.newFixnum(11));
  99. rb_mConstants.setConstant("IP_ADD_MEMBERSHIP", runtime.newFixnum(12));
  100. rb_mConstants.setConstant("IP_MAX_MEMBERSHIPS", runtime.newFixnum(20));
  101. rb_mConstants.setConstant("IP_DEFAULT_MULTICAST_LOOP", runtime.newFixnum(1));
  102. rb_mConstants.setConstant("IP_DEFAULT_MULTICAST_TTL", runtime.newFixnum(1));
  103. rb_cSocket.includeModule(rb_mConstants);
  104. rb_cSocket.defineAnnotatedMethods(RubySocket.class);
  105. }
  106. private static ObjectAllocator SOCKET_ALLOCATOR = new ObjectAllocator() {
  107. public IRubyObject allocate(Ruby runtime, RubyClass klass) {
  108. return new RubySocket(runtime, klass);
  109. }
  110. };
  111. public RubySocket(Ruby runtime, RubyClass type) {
  112. super(runtime, type);
  113. }
  114. @JRubyMethod(meta = true)
  115. public static IRubyObject for_fd(ThreadContext context, IRubyObject socketClass, IRubyObject fd) {
  116. Ruby runtime = context.runtime;
  117. if (fd instanceof RubyFixnum) {
  118. int intFD = (int)((RubyFixnum)fd).getLongValue();
  119. ChannelDescriptor descriptor = ChannelDescriptor.getDescriptorByFileno(intFD);
  120. if (descriptor == null) {
  121. throw runtime.newErrnoEBADFError();
  122. }
  123. RubySocket socket = (RubySocket)((RubyClass)socketClass).allocate();
  124. socket.initFieldsFromDescriptor(runtime, descriptor);
  125. socket.initSocket(runtime, descriptor);
  126. return socket;
  127. } else {
  128. throw runtime.newTypeError(fd, context.runtime.getFixnum());
  129. }
  130. }
  131. @JRubyMethod(compat = CompatVersion.RUBY1_8)
  132. public IRubyObject initialize(ThreadContext context, IRubyObject domain, IRubyObject type, IRubyObject protocol) {
  133. Ruby runtime = context.runtime;
  134. initFieldsFromArgs(runtime, domain, type, protocol);
  135. ChannelDescriptor descriptor = initChannel(runtime);
  136. initSocket(runtime, descriptor);
  137. return this;
  138. }
  139. @JRubyMethod(name = "initialize", compat = CompatVersion.RUBY1_9)
  140. public IRubyObject initialize19(ThreadContext context, IRubyObject domain, IRubyObject type) {
  141. Ruby runtime = context.runtime;
  142. initFieldsFromArgs(runtime, domain, type);
  143. ChannelDescriptor descriptor = initChannel(runtime);
  144. initSocket(runtime, descriptor);
  145. return this;
  146. }
  147. @JRubyMethod(name = "initialize", compat = CompatVersion.RUBY1_9)
  148. public IRubyObject initialize19(ThreadContext context, IRubyObject domain, IRubyObject type, IRubyObject protocol) {
  149. Ruby runtime = context.runtime;
  150. initFieldsFromArgs(runtime, domain, type, protocol);
  151. ChannelDescriptor descriptor = initChannel(runtime);
  152. initSocket(runtime, descriptor);
  153. return this;
  154. }
  155. @JRubyMethod()
  156. public IRubyObject connect_nonblock(ThreadContext context, IRubyObject arg) {
  157. SocketAddress addr = addressForChannel(context, arg);
  158. doConnectNonblock(context, getChannel(), addr);
  159. return RubyFixnum.zero(context.runtime);
  160. }
  161. @JRubyMethod()
  162. public IRubyObject connect(ThreadContext context, IRubyObject arg) {
  163. SocketAddress addr = addressForChannel(context, arg);
  164. doConnect(context, getChannel(), addr);
  165. return RubyFixnum.zero(context.runtime);
  166. }
  167. @JRubyMethod()
  168. public IRubyObject bind(ThreadContext context, IRubyObject arg) {
  169. InetSocketAddress iaddr = Sockaddr.addressFromSockaddr_in(context, arg);
  170. doBind(context, getChannel(), iaddr);
  171. return RubyFixnum.zero(context.runtime);
  172. }
  173. @JRubyMethod
  174. public IRubyObject recvfrom(ThreadContext context, IRubyObject length) {
  175. return super.recv(context, length);
  176. }
  177. @JRubyMethod
  178. public IRubyObject recvfrom(ThreadContext context, IRubyObject length, IRubyObject flags) {
  179. return super.recv(context, length, flags);
  180. }
  181. @JRubyMethod
  182. public IRubyObject recvfrom_nonblock(ThreadContext context, IRubyObject length) {
  183. return super.recv_nonblock(context, length);
  184. }
  185. @JRubyMethod
  186. public IRubyObject recvfrom_nonblock(ThreadContext context, IRubyObject length, IRubyObject flags) {
  187. return super.recv_nonblock(context, length, flags);
  188. }
  189. @JRubyMethod(notImplemented = true)
  190. public IRubyObject listen(ThreadContext context, IRubyObject backlog) {
  191. throw SocketUtils.sockerr(context.runtime, JRUBY_SERVER_SOCKET_ERROR);
  192. }
  193. @JRubyMethod(notImplemented = true)
  194. public IRubyObject accept(ThreadContext context) {
  195. throw SocketUtils.sockerr(context.runtime, JRUBY_SERVER_SOCKET_ERROR);
  196. }
  197. @JRubyMethod(meta = true)
  198. public static IRubyObject gethostname(ThreadContext context, IRubyObject recv) {
  199. return SocketUtils.gethostname(context);
  200. }
  201. @JRubyMethod(required = 1, rest = true, meta = true)
  202. public static IRubyObject gethostbyaddr(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  203. return SocketUtils.gethostbyaddr(context, args);
  204. }
  205. @JRubyMethod(required = 1, optional = 1, meta = true)
  206. public static IRubyObject getservbyname(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  207. return SocketUtils.getservbyname(context, args);
  208. }
  209. @JRubyMethod(name = {"pack_sockaddr_in", "sockaddr_in"}, meta = true)
  210. public static IRubyObject pack_sockaddr_in(ThreadContext context, IRubyObject recv, IRubyObject port, IRubyObject host) {
  211. return SocketUtils.pack_sockaddr_in(context, port, host);
  212. }
  213. @JRubyMethod(meta = true)
  214. public static IRubyObject unpack_sockaddr_in(ThreadContext context, IRubyObject recv, IRubyObject addr) {
  215. return Sockaddr.unpack_sockaddr_in(context, addr);
  216. }
  217. @JRubyMethod(name = {"pack_sockaddr_un", "sockaddr_un"}, meta = true)
  218. public static IRubyObject pack_sockaddr_un(ThreadContext context, IRubyObject recv, IRubyObject filename) {
  219. return SocketUtils.pack_sockaddr_un(context, filename);
  220. }
  221. @JRubyMethod(meta = true)
  222. public static IRubyObject gethostbyname(ThreadContext context, IRubyObject recv, IRubyObject hostname) {
  223. return SocketUtils.gethostbyname(context, hostname);
  224. }
  225. @JRubyMethod(required = 2, optional = 4, meta = true)
  226. public static IRubyObject getaddrinfo(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  227. return SocketUtils.getaddrinfo(context, args);
  228. }
  229. @JRubyMethod(required = 1, optional = 1, meta = true)
  230. public static IRubyObject getnameinfo(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  231. return SocketUtils.getnameinfo(context, args);
  232. }
  233. @JRubyMethod(meta = true, compat = CompatVersion.RUBY1_9)
  234. public static IRubyObject ip_address_list(ThreadContext context, IRubyObject self) {
  235. return SocketUtils.ip_address_list(context);
  236. }
  237. @Override
  238. protected Sock getDefaultSocketType() {
  239. return soType;
  240. }
  241. private void initFieldsFromDescriptor(Ruby runtime, ChannelDescriptor descriptor) {
  242. Channel mainChannel = descriptor.getChannel();
  243. if (mainChannel instanceof SocketChannel) {
  244. // ok, it's a socket...set values accordingly
  245. // just using AF_INET since we can't tell from SocketChannel...
  246. soDomain = AddressFamily.AF_INET;
  247. soType = Sock.SOCK_STREAM;
  248. soProtocol = ProtocolFamily.PF_INET;
  249. } else if (mainChannel instanceof UnixSocketChannel) {
  250. soDomain = AddressFamily.AF_UNIX;
  251. soType = Sock.SOCK_STREAM;
  252. soProtocol = ProtocolFamily.PF_UNIX;
  253. } else if (mainChannel instanceof DatagramChannel) {
  254. // datagram, set accordingly
  255. // again, AF_INET
  256. soDomain = AddressFamily.AF_INET;
  257. soType = Sock.SOCK_DGRAM;
  258. soProtocol = ProtocolFamily.PF_INET;
  259. } else {
  260. throw runtime.newErrnoENOTSOCKError("can't Socket.new/for_fd against a non-socket");
  261. }
  262. }
  263. private void initFieldsFromArgs(Ruby runtime, IRubyObject domain, IRubyObject type, IRubyObject protocol) {
  264. initDomain(runtime, domain);
  265. initType(runtime, type);
  266. initProtocol(runtime, protocol);
  267. }
  268. private void initFieldsFromArgs(Ruby runtime, IRubyObject domain, IRubyObject type) {
  269. initDomain(runtime, domain);
  270. initType(runtime, type);
  271. }
  272. protected void initFromServer(Ruby runtime, RubyServerSocket serverSocket, SocketChannel socketChannel) {
  273. soDomain = serverSocket.soDomain;
  274. soType = serverSocket.soType;
  275. soProtocol = serverSocket.soProtocol;
  276. initSocket(runtime, newChannelDescriptor(runtime, socketChannel));
  277. }
  278. protected ChannelDescriptor initChannel(Ruby runtime) {
  279. Channel channel;
  280. try {
  281. if(soType == Sock.SOCK_STREAM) {
  282. if (soProtocol == ProtocolFamily.PF_UNIX ||
  283. soProtocol == ProtocolFamily.PF_LOCAL) {
  284. channel = UnixSocketChannel.open();
  285. } else if (soProtocol == ProtocolFamily.PF_INET ||
  286. soProtocol == ProtocolFamily.PF_INET6 ||
  287. soProtocol == ProtocolFamily.PF_UNSPEC) {
  288. channel = SocketChannel.open();
  289. } else {
  290. throw runtime.newArgumentError("unsupported protocol family `" + soProtocol + "'");
  291. }
  292. } else if(soType == Sock.SOCK_DGRAM) {
  293. channel = DatagramChannel.open();
  294. } else {
  295. throw runtime.newArgumentError("unsupported socket type `" + soType + "'");
  296. }
  297. return newChannelDescriptor(runtime, channel);
  298. } catch(IOException e) {
  299. throw SocketUtils.sockerr(runtime, "initialize: " + e.toString());
  300. }
  301. }
  302. protected static ChannelDescriptor newChannelDescriptor(Ruby runtime, Channel channel) {
  303. ModeFlags modeFlags = newModeFlags(runtime, ModeFlags.RDWR);
  304. return new ChannelDescriptor(channel, modeFlags);
  305. }
  306. private void initProtocol(Ruby runtime, IRubyObject protocol) {
  307. ProtocolFamily protocolFamily = SocketUtils.protocolFamilyFromArg(protocol);
  308. if (protocolFamily == null) {
  309. return; // no protocol specified, ignore it
  310. }
  311. soProtocol = protocolFamily;
  312. }
  313. private void initType(Ruby runtime, IRubyObject type) {
  314. Sock sockType = SocketUtils.sockFromArg(type);
  315. if (sockType == null) {
  316. throw SocketUtils.sockerr(runtime, "unknown socket type " + type);
  317. }
  318. soType = sockType;
  319. }
  320. private void initDomain(Ruby runtime, IRubyObject domain) {
  321. AddressFamily family = SocketUtils.addressFamilyFromArg(domain);
  322. if (family == null) {
  323. throw SocketUtils.sockerr(runtime, "unknown socket domain " + domain);
  324. }
  325. soDomain = family;
  326. soProtocol = ProtocolFamily.valueOf("PF" + soDomain.name().substring(2));
  327. }
  328. private void doConnectNonblock(ThreadContext context, Channel channel, SocketAddress addr) {
  329. if (!(channel instanceof SelectableChannel)) {
  330. throw getRuntime().newErrnoENOPROTOOPTError();
  331. }
  332. SelectableChannel selectable = (SelectableChannel)channel;
  333. synchronized (selectable.blockingLock()) {
  334. boolean oldBlocking = selectable.isBlocking();
  335. try {
  336. selectable.configureBlocking(false);
  337. try {
  338. doConnect(context, channel, addr);
  339. } finally {
  340. selectable.configureBlocking(oldBlocking);
  341. }
  342. } catch(ClosedChannelException e) {
  343. throw context.runtime.newErrnoECONNREFUSEDError();
  344. } catch(IOException e) {
  345. throw SocketUtils.sockerr(context.runtime, "connect(2): name or service not known");
  346. }
  347. }
  348. }
  349. protected void doConnect(ThreadContext context, Channel channel, SocketAddress addr) {
  350. Ruby runtime = context.runtime;
  351. try {
  352. if (channel instanceof SocketChannel) {
  353. SocketChannel socket = (SocketChannel)channel;
  354. boolean result;
  355. if (socket.isConnectionPending()) {
  356. // connection initiated but not finished
  357. result = socket.finishConnect();
  358. } else {
  359. result = socket.connect(addr);
  360. }
  361. if(!result) {
  362. if (runtime.is1_9()) {
  363. throw runtime.newErrnoEINPROGRESSWritableError();
  364. } else {
  365. throw runtime.newErrnoEINPROGRESSError();
  366. }
  367. }
  368. } else if (channel instanceof UnixSocketChannel) {
  369. ((UnixSocketChannel)channel).connect((UnixSocketAddress)addr);
  370. } else if (channel instanceof DatagramChannel) {
  371. ((DatagramChannel)channel).connect(addr);
  372. } else {
  373. throw runtime.newErrnoENOPROTOOPTError();
  374. }
  375. } catch(AlreadyConnectedException e) {
  376. throw runtime.newErrnoEISCONNError();
  377. } catch(ConnectionPendingException e) {
  378. if (runtime.is1_9()) {
  379. throw runtime.newErrnoEINPROGRESSWritableError();
  380. } else {
  381. throw runtime.newErrnoEINPROGRESSError();
  382. }
  383. } catch(UnknownHostException e) {
  384. throw SocketUtils.sockerr(runtime, "connect(2): unknown host");
  385. } catch(SocketException e) {
  386. handleSocketException(runtime, "connect", e);
  387. } catch(IOException e) {
  388. throw SocketUtils.sockerr(runtime, "connect(2): name or service not known");
  389. } catch (IllegalArgumentException iae) {
  390. throw SocketUtils.sockerr(runtime, iae.getMessage());
  391. }
  392. }
  393. protected void doBind(ThreadContext context, Channel channel, InetSocketAddress iaddr) {
  394. Ruby runtime = context.runtime;
  395. try {
  396. if (channel instanceof SocketChannel) {
  397. Socket socket = ((SocketChannel)channel).socket();
  398. socket.bind(iaddr);
  399. } else if (channel instanceof UnixSocketChannel) {
  400. // do nothing
  401. } else if (channel instanceof DatagramChannel) {
  402. DatagramSocket socket = ((DatagramChannel)channel).socket();
  403. socket.bind(iaddr);
  404. } else {
  405. throw runtime.newErrnoENOPROTOOPTError();
  406. }
  407. } catch(UnknownHostException e) {
  408. throw SocketUtils.sockerr(runtime, "bind(2): unknown host");
  409. } catch(SocketException e) {
  410. handleSocketException(runtime, "bind", e);
  411. } catch(IOException e) {
  412. throw SocketUtils.sockerr(runtime, "bind(2): name or service not known");
  413. } catch (IllegalArgumentException iae) {
  414. throw SocketUtils.sockerr(runtime, iae.getMessage());
  415. }
  416. }
  417. protected void handleSocketException(Ruby runtime, String caller, SocketException e) {
  418. String msg = formatMessage(e, "bind");
  419. // This is ugly, but what can we do, Java provides the same exception type
  420. // for different situations, so we differentiate the errors
  421. // based on the exception's message.
  422. if (ALREADY_BOUND_PATTERN.matcher(msg).find()) {
  423. throw runtime.newErrnoEINVALError(msg);
  424. } else if (ADDR_NOT_AVAIL_PATTERN.matcher(msg).find()) {
  425. throw runtime.newErrnoEADDRNOTAVAILError(msg);
  426. } else if (PERM_DENIED_PATTERN.matcher(msg).find()) {
  427. throw runtime.newErrnoEACCESError(msg);
  428. } else {
  429. throw runtime.newErrnoEADDRINUSEError(msg);
  430. }
  431. }
  432. private static String formatMessage(Throwable e, String defaultMsg) {
  433. String msg = e.getMessage();
  434. if (msg == null) {
  435. msg = defaultMsg;
  436. } else {
  437. msg = defaultMsg + " - " + msg;
  438. }
  439. return msg;
  440. }
  441. private SocketAddress addressForChannel(ThreadContext context, IRubyObject arg) {
  442. switch (soProtocol) {
  443. case PF_UNIX:
  444. case PF_LOCAL:
  445. return Sockaddr.addressFromSockaddr_un(context, arg);
  446. case PF_INET:
  447. case PF_INET6:
  448. case PF_UNSPEC:
  449. return Sockaddr.addressFromSockaddr_in(context, arg);
  450. default:
  451. throw context.runtime.newArgumentError("unsupported protocol family `" + soProtocol + "'");
  452. }
  453. }
  454. @Deprecated
  455. public static RuntimeException sockerr(Ruby runtime, String msg) {
  456. return new RaiseException(runtime, runtime.getClass("SocketError"), msg, true);
  457. }
  458. private static final Pattern ALREADY_BOUND_PATTERN = Pattern.compile("[Aa]lready.*bound");
  459. private static final Pattern ADDR_NOT_AVAIL_PATTERN = Pattern.compile("assign.*address");
  460. private static final Pattern PERM_DENIED_PATTERN = Pattern.compile("[Pp]ermission.*denied");
  461. public static final int MSG_OOB = 0x1;
  462. public static final int MSG_PEEK = 0x2;
  463. public static final int MSG_DONTROUTE = 0x4;
  464. public static final int MSG_WAITALL = 0x100;
  465. protected AddressFamily soDomain;
  466. protected Sock soType;
  467. protected ProtocolFamily soProtocol;
  468. private static final String JRUBY_SERVER_SOCKET_ERROR =
  469. "use ServerSocket for servers (http://wiki.jruby.org/ServerSocket)";
  470. }// RubySocket