Get the current Socket for this call.
Only works in the main thread call.

@return Socket which started the Delegator Thread
424096
public static Socket getCurrentSocket() {
        ConnectionHandler handler = connectionMap.get(Thread.currentThread());
        return (handler == null ? null : handler.getSocket());
    }
582887
public ThreadContext getThreadContext() {
        if (useInheritableThreadLocal && !SSLConfigManager.getInstance().isServerProcess()) {
            ThreadContext context = inheritableThreadLocStorage.get();

            if (context == null) {
                context = new ThreadContext();
                inheritableThreadLocStorage.set(context);
            }
            return context;
        }
        ThreadContext context = threadLocStorage.get();

        if (context == null) {
            context = new ThreadContext();
            threadLocStorage.set(context);
        }

        return context;
    }
433600
public Socket getSocket(String host, int port, boolean useSecureSocket, SecurityDomain securityDomain) throws Exception {
		return getSocket(host,port,useSecureSocket,securityDomain,null);
	}
1215409
public Socket getSocket(String host, int port, boolean useSecureSocket) throws Exception 
	{
		// Get the registered security domain for the URI
		SecurityDomain securityDomain = null;
		if (useSecureSocket) {
			securityDomain = CONTEXT.getSecurityDomainManager().getSecurityDomain(host,port);
		}
		return getSocket(host,port,useSecureSocket,securityDomain);
	}
433347
private function getSock()
    {
        // Try connecting
        if (!($sock = @fsockopen($this->host, $this->port, $errno, $errstr, self::timeout))) {
            throw new Exception('Error connecting');
        }

        // Try getting stuff
        $buffer = '';
        while ($mid = @fgets($sock)) {
            $buffer .= $mid;
        }

        // Quit
        @fclose($sock);

        // Output:
        return $buffer;
    }
1012943
def get_socket(self, address, role):
        
        #
        # If this thread doesn't yet have a sockets cache
        # in its local storage, create one here.
        #
        try:
            self._tls.sockets
        except AttributeError:
            self._tls.sockets = {}
        
        # Convert the address to a single canonical string.
        #
        # If a list of addresses is passed, turn it into a tuple
        # of canonical addresses for use as a dictionary key. 
        # Otherwise convert it to a single canonical string.
        #
        if isinstance(address, list):
            caddress = tuple(core.address(a) for a in address)
        else:
            caddress = core.address(address)
            
        #
        # Each socket is identified for this thread by its address(es)
        # and the role the socket is playing (listener, publisher, etc.)
        # That is, within one thread, we are cacheing a read or a write
        # socket to the same address(es).
        #
        # The slight corner case from this is that if you attempt to
        # send to [addressA, addressB] and then to addressA and then
        # to [addressB, addressA], three separate sockets will be
        # created and used.
        #
        identifier = caddress
        
        if identifier not in self._tls.sockets:
            _logger.debug("%s does not exist in local sockets", identifier)
            #
            # If this is a listening / subscribing socket, it can only
            # be bound once, regardless of thread. Therefore keep a
            # threads-global list of addresses used and make sure this
            # one hasn't been used elsewhere.
            #
            if role in Socket.binding_roles:
                with self._lock:
                    if identifier in self._sockets:
                        raise core.SocketAlreadyExistsError("You cannot create a listening socket in more than one thread")
                    else:
                        self._sockets.add(identifier)
            
            type = self.roles[role]
            socket = context.socket(type)
            socket.role = role
            socket.address = caddress
            #
            # Do this last so that an exception earlier will result
            # in the socket not being cached
            #
            self._tls.sockets[identifier] = socket
        else:
            _logger.debug("%s already not exist in local sockets", identifier)
            #
            # Only return sockets created in this thread
            #
            socket = self._tls.sockets[identifier]

        return socket
1238010
@SuppressWarnings("unchecked")
  public static SocketHandlerFunction getSocketHandler() {
    try {
      //forcing use of JNA to ensure AOT compilation
      Platform.getOSType();

      return (urlParser, host) -> {
        if (urlParser.getOptions().pipe != null) {
          return new NamedPipeSocket(host, urlParser.getOptions().pipe);
        } else if (urlParser.getOptions().localSocket != null) {
          try {
            return new UnixDomainSocket(urlParser.getOptions().localSocket);
          } catch (RuntimeException re) {
            throw new IOException(re.getMessage(), re.getCause());
          }
        } else if (urlParser.getOptions().sharedMemory != null) {
          try {
            return new SharedMemorySocket(urlParser.getOptions().sharedMemory);
          } catch (RuntimeException re) {
            throw new IOException(re.getMessage(), re.getCause());
          }
        } else {
          return Utils.standardSocket(urlParser, host);
        }

      };
    } catch (Throwable cle) {
      //jna jar's are not in classpath
    }
    return (urlParser, host) -> Utils.standardSocket(urlParser, host);
  }
886719
protected SocketBox openSocket() throws Exception {
        logger.debug("server.accept()");

        SocketBox sBox = new SimpleSocketBox();
        Socket newSocket = myServer.accept();
        sBox.setSocket(newSocket);

        return sBox;
    }
675573
private Socket getTLSSocket(InetAddress destination, int port) throws Exception
	{
		String key = destination.getHostAddress() + ":" + port;
		synchronized (socketMap){
			Socket socket = socketMap.get(key);
			if (socket == null){
				// create a new one
				NodeAuthModuleContext nodeAuthContext = NodeAuthModuleContext.getContext();
	        	socket = nodeAuthContext.getSocketHandler().getSocket(destination.getHostName(), port, true);
	        	// remember it for next time
	        	// TODO: had trouble with this with Steve Moore's online ATNA server so not caching the sockets
	        	// need to worry about synchronization if we try to put this optimization back
	        	// there appears to be one AuditorModuleContext per host/port so may can pool them based on that object?
				socketMap.put(key, socket);
			}
			// whatever happened, now return the socket
			return socket;		
		}
	}
334364
SocketChannel createSock() throws IOException {
        SocketChannel sock;
        sock = SocketChannel.open();
        sock.configureBlocking(false);
        sock.socket().setSoLinger(false, -1);
        sock.socket().setTcpNoDelay(true);
        return sock;
    }
1286262
public CheckedSocket getSocket(Object session)
        throws ConnectException, SocketException
    {
        return CheckedSocket.check(new LazySocket(mFactory, session));
    }
48286
public synchronized int getSoTimeout() throws IOException {
        if (isClosed())
            throw new SocketException("Socket is closed");
        Object o = getImpl().getOption(SocketOptions.SO_TIMEOUT);
        /* extra type safety */
        if (o instanceof Integer) {
            return ((Integer) o).intValue();
        } else {
            return 0;
        }
    }
915954
public long getSocketChannelHandle(SocketChannel socketChannel) {
        StartPrivilegedThread privThread = new StartPrivilegedThread(socketChannel);
        return AccessController.doPrivileged(privThread);
    }
1084516
public static OutboxAmp getOutboxCurrent()
  {
    OutboxAmp outbox = OutboxAmp.current();
    
    if (outbox != null) {
      // OutboxAmp outbox = (OutboxAmp) outboxDeliver;
    
      return outbox;
    }
    else {
      return OutboxAmpNull.NULL;
    }
  }
860462
protected synchronized Dispatchable getThreadContext()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getThreadContext");

      // Start D202625
      // Save the position of the data
      int currentPos = data.position();
      int currentLimit = data.limit();
      Dispatchable dis = null;

      try
      {
         dis = listener.getThreadContext(conversation, data, segmentType);
      }
      catch (Throwable t)
      {
         FFDCFilter.processException(t, "com.ibm.ws.sib.jfapchannel.impl.rldispatcher.ConversationReceiveListenerDataReceivedInvocation.getThreadContext",
                                     JFapChannelConstants.CRLDATARECEIVEDINVOKE_GETTHREADCONTEXT_01,
                                     this);

         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "exception thrown by getThreadContext");
         if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, t);

         // User has thrown an exception from getThreadContext method.  Probably
         // the best way to deal with this is to invalidate their connection.
         // That'll learn 'em.
         connection.invalidate(true, t, "exception thrown from getThreadContext - "+t.getMessage());  // D224570

         // Throw this bad boy to indicate to the dispatcher that something has gone wrong and
         // that it should abort processing this segment.
         throw new SIErrorException(TraceNLS.getFormattedMessage(JFapChannelConstants.MSG_BUNDLE, "CRLDRI_INTERNAL_SICJ0065", null, "CRLDRI_INTERNAL_SICJ0065")); // D226223
      }

      // Make sure we re-position the data
      data.position(currentPos);
      data.limit(currentLimit);
      // End D202625

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getThreadContext",dis);
      return dis;
   }
1321856
public function run()
	{
		$this->connect();

		try
		{
			while (!$this->feof())
			{
				$data = $this->irc_read(60); // We wait 60 seconds but it's arbitrary and can be safely modified...
				if ($data === false)
				{
					continue;
				}

				$this->callListeners($data);
			}
		}
		catch (SocketDisconnectedException $e)
		{
			return $this;
		}

		return $this;
	}
710160
public static javax.net.SocketFactory getDefault() {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "getDefault");

        if (thisClass == null) {
            try {
                thisClass = new com.ibm.ws.ssl.protocol.LibertySSLSocketFactory();
            } catch (Exception e) {
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "SSLSocketFactory exception getting default socket factory.", new Object[] { e });
                FFDCFilter.processException(e, "SSLSocketFactory", "getDefault", thisClass);
            }
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "getDefault");
        return thisClass;
    }