Examples of

    public SocketClientInstance(ObjectChannel objectSocket, ClientServiceRegistryImpl csr, boolean isClientEncryptionEnabled) {
        this.objectSocket = objectSocket;
        this.csr = csr;
        this.usingEncryption = isClientEncryptionEnabled;
        SocketAddress address = this.objectSocket.getRemoteAddress();
        if (address instanceof InetSocketAddress) {
          InetSocketAddress addr = (InetSocketAddress)address;
View Full Code Here

            if (logmon.isLoggable(BasicLevel.DEBUG)) {
              logmon.log(BasicLevel.DEBUG, this.getName() + ", received message from: " + " "
                  + packet.getAddress() + ":" + packet.getPort());

            SocketAddress socketAddress = packet.getSocketAddress();
            ServerInfo srvInfo = ((ServerInfo) serversInfo.get(socketAddress));
            if (srvInfo == null) {
              srvInfo = new ServerInfo();
              try {
                MXWrapper.registerMBean(srvInfo, "AgentServer", getMBeanName(socketAddress.toString()
                    .replace(':', '#')));
              } catch (Exception exc) {
                logmon.log(BasicLevel.ERROR, getName() + " jmx failed", exc);
              serversInfo.put(socketAddress, srvInfo);
View Full Code Here

            Enumeration enuAddr = serversInfo.keys();
            long currentTimeMillis = System.currentTimeMillis();
            while (enuAddr.hasMoreElements()) {
              SocketAddress addr = (SocketAddress) enuAddr.nextElement();
              ServerInfo servInfo = (ServerInfo) serversInfo.get(addr);
              synchronized (servInfo.lock) {
                if (!hasBeenForced
View Full Code Here

                // if no local address has been configured, make sure we use the same as the client connects from
                if(localAddr == null) {
                    localAddr = ((InetSocketAddress)session.getLocalAddress()).getAddress();

                SocketAddress localSocketAddress = new InetSocketAddress(localAddr, dataConfig.getActiveLocalPort());
                LOG.debug("Binding active data connection to {}", localSocketAddress);

                dataSoc.connect(new InetSocketAddress(address, port));
View Full Code Here

    public SocketAddress getRemoteAddress() {
  // when closing a socket, the remote address might be reset to null
  // therefore, we attempt to keep a cached copy around

  SocketAddress address = wrappedSession.getRemoteAddress();
  if (address == null
    && containsAttribute(ATTRIBUTE_CACHED_REMOTE_ADDRESS)) {
      return (SocketAddress) getAttribute(ATTRIBUTE_CACHED_REMOTE_ADDRESS);
  } else {
      setAttribute(ATTRIBUTE_CACHED_REMOTE_ADDRESS, address);
View Full Code Here

  private static String getServerVariableValue(FtpIoSession session,
    String varName) {

    String varVal = null;

    SocketAddress localSocketAddress = session.getLocalAddress();

    if (localSocketAddress instanceof InetSocketAddress) {
      InetSocketAddress localInetSocketAddress = (InetSocketAddress) localSocketAddress;
      // server address
      if (varName.equals(SERVER_IP)) {
View Full Code Here

    private SocketUtils() {}

    public static Socket openSocket(InetAddress addr, int port, int connectTimeout, long pollDelay, int maxRetry)
            throws IOException {
        SocketAddress sockAddr = new InetSocketAddress(addr, port);
        return openSocket(sockAddr, connectTimeout, pollDelay, maxRetry);
View Full Code Here

        return openSocket(sockAddr, connectTimeout, pollDelay, maxRetry);

    public static Socket openSocket(String host, int port, int connectTimeout, long pollDelay, int maxRetry)
            throws IOException {
        SocketAddress sockAddr = new InetSocketAddress(host, port);
        return openSocket(sockAddr, connectTimeout, pollDelay, maxRetry);
View Full Code Here

   * @see Kryo#register(Class, com.esotericsoftware.kryo.Serializer)
   * @throws IllegalStateException if this connection was not opened with both TCP and UDP.
  public int sendUDP (Object object) {
    if (object == null) throw new IllegalArgumentException("object cannot be null.");
    SocketAddress address = udpRemoteAddress;
    if (address == null && udp != null) address = udp.connectedAddress;
    if (address == null && isConnected) throw new IllegalStateException("Connection is not connected via UDP.");

    Context context = Kryo.getContext();
    context.put("connection", this);
View Full Code Here

  public static void start( final Index index, final ServerSocket serverSocket, boolean forceRemoteIndex ) throws IOException { "Index server started at " + serverSocket.getLocalSocketAddress() );
    ThreadPoolExecutor threadPool = (ThreadPoolExecutor)Executors.newCachedThreadPool();
    Socket socket;
    final SocketAddress localSocketAddress = serverSocket.getLocalSocketAddress();
    int command;
    for ( ;; ) {
      socket = serverSocket.accept();
      command = socket.getInputStream().read();
View Full Code Here


Related Classes of

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact