Accepts a new socket.
352607
public boolean accept(SocketBar qSocket)
    throws IOException
  {
    SocketWrapperBar s = (SocketWrapperBar) qSocket;

    Socket socket = _ss.accept();

    if (socket == null)
      return false;

    s.init(socket);

    /*
    // XXX:
    if (isTcpNoDelay())
      socket.setTcpNoDelay(true);
    
    if (isTcpKeepalive())
      socket.setKeepAlive(true);

    if (_connectionSocketTimeout > 0)
      socket.setSoTimeout(_connectionSocketTimeout);

    s.init(socket);
    */

    if (_connectionSocketTimeout > 0) {
      socket.setSoTimeout(_connectionSocketTimeout);
    }
    
    return true;
  }
1087023
public void initiateOnReceivingSide(Socket socket, boolean isForOutgoing, int version) throws IOException
    {
        if (isForOutgoing)
            outgoing.start(socket, version);
        else
            incoming.start(socket, version);
    }
457702
def port(self, port=None):
        
        if (port is None) or (port == self.__port):
            return self.__port
        # when port change ensure old socket is close
        self.close()
        # valid port ?
        if 0 < int(port) < 65536:
            self.__port = int(port)
            return self.__port
        else:
            return None
1016661
public <T> void setSocketOption(SocketOption<T> socketOption, T value) {
		this.socketOptions.put(socketOption, value);
	}
7834
def accept(self):
        
        sock, address = self.sock.accept()
        wsock = websocket(sock)
        wsock.secure = self.secure
        ServerHandshake(wsock).perform(self)
        wsock.handshake_sent = True
        return wsock, address
28684
public void run(Socket socket) {
    synchronized (lock) {
      nextSocket = socket;
      lock.notify();
    }
    Thread.yield();
  }
239524
protected ItemHolder create(final Socket socket, final EventsHandler handler, final int events)
    {
        Objects.requireNonNull(socket, "Socket has to be non-null");
        return creator.create(socket, handler, events);
    }
298802
@Override
	public Socket makeObject(InetSocketAddress address) throws Exception {
		Socket socket = new Socket(address.getHostName(), address.getPort());
		socket.setKeepAlive(true);
		return socket;
	}
759991
function Socket(options) {
  if (!(this instanceof Socket)) {
    return new Socket(options);
  }
  var tty = process.binding('tty_wrap');
  var guessHandleType = tty.guessHandleType;
  tty.guessHandleType = function() {
    return 'PIPE';
  };
  net.Socket.call(this, options);
  tty.guessHandleType = guessHandleType;
}
1127679
def serve(self):
    """"""
    # We don't have to trap KeyboardInterrupt or SystemExit here,

    # Select the appropriate socket
    if isinstance(self.bind_addr, basestring):
      # AF_UNIX socket

      # So we can reuse the socket...
      try: os.unlink(self.bind_addr)
      except: pass

      # So everyone can access the socket...
      try: os.chmod(self.bind_addr, 0777)
      except: pass

      info = [(socket.AF_UNIX, socket.SOCK_STREAM, 0, "", self.bind_addr)]
    else:
      # AF_INET or AF_INET6 socket
      # Get the correct address family for our host (allows IPv6 addresses)
      host, port = self.bind_addr
      try:
        info = socket.getaddrinfo(host, port, socket.AF_UNSPEC,
                      socket.SOCK_STREAM, 0, socket.AI_PASSIVE)
      except socket.gaierror:
        # Probably a DNS issue. Assume IPv4.
        info = [(socket.AF_INET, socket.SOCK_STREAM, 0, "", self.bind_addr)]

    self.socket = None
    msg = "No socket could be created"
    for res in info:
      af, socktype, proto, canonname, sa = res
      #~ print res
      try:
        self.bind(af, socktype, proto)
      except socket.error, msg:
        if self.socket:
          self.socket.close()
        self.socket = None
        continue
      break
    if not self.socket:
      raise socket.error, msg

    self.socket.listen(self.request_queue_size)
    with closing(self.socket):
      while True:
        try:
          s, addr = yield sockets.Accept(self.socket, timeout=-1)
          s.settimeout(self.sockoper_timeout)
        except Exception, exc:
          # make acceptor more robust in the face of weird
          # accept bugs, XXX: but we might get a infinite loop

          #~ import warnings
          #~ warnings.warn("Accept thrown an exception: %s" % exc)

          import traceback
          traceback.print_exc()
          continue

        environ = self.environ.copy()
        environ["SERVER_SOFTWARE"] = self.version
        # set a non-standard environ entry so the WSGI app can know what
        # the *real* server protocol is (and what features to support).
        # See http://www.faqs.org/rfcs/rfc2145.html.
        environ["ACTUAL_SERVER_PROTOCOL"] = self.protocol
        environ["SERVER_NAME"] = self.server_name

        if isinstance(self.bind_addr, basestring):
          # AF_UNIX. This isn't really allowed by WSGI, which doesn't
          # address unix domain sockets. But it's better than nothing.
          environ["SERVER_PORT"] = ""
        else:
          environ["SERVER_PORT"] = str(self.bind_addr[1])
          # optional values
          # Until we do DNS lookups, omit REMOTE_HOST
          environ["REMOTE_ADDR"] = addr[0]
          environ["REMOTE_PORT"] = str(addr[1])

        conn = self.ConnectionClass(s, self.wsgi_app, environ,
          self.sendfile_timeout)
        yield events.AddCoro(conn.run, prio=priority.LAST if
                                     self.sockaccept_greedy else priority.FIRST)
867769
def initialize_socket(uri, opts = {})
      return if opts[:socket]

      @socket = TCPSocket.new(uri.host, uri.port)
      opts.merge!({:socket => @socket})
      @intentional_termination = false
    end
985646
def _new_wire(self, source, sinks=None):
        """"""
        # Assign sequential routing key to new nets.
        wire = _Wire(source, sinks if sinks is not None else [], len(self._wires))
        self._wires.append(wire)

        return wire
1037348
function Socket() {
  this.socks = [];
  this.settings = {};
  this.connected = false;
  this.set('identity', String(process.pid));
  this.set('retry timeout', 100);
  this.set('retry max timeout', 5000);
}
1308507
function Accepts (req) {
  if (!(this instanceof Accepts)) {
    return new Accepts(req)
  }

  this.headers = req.headers
  this.negotiator = new Negotiator(req)
}
902390
def socket(self):
        """"""
        if self._ssl:
            if self._useSecuredWebsocket:
                return self._ssl.getSSLSocket()
            else:
                return self._ssl
        else:
            return self._sock
544958
public void setSocket(Socket socket) throws IOException {
        if (this.socket != null) {
            this.socket.close();
            this.socket = null;
        }
        this.socket = socket;
        setTimeout(timeout);
        prepareStreams(socket);
    }
252588
function init(entry, socket, req) {  // {{{2
/**
 * Class constructor
 *
 * @param entry {Object} Entry of xorg kind
 *
 * @method constructor
 */

  this.entry = entry;

  O.link.open(this, socket);
}