Examples of SocketAddress


Examples of java.net.SocketAddress

//            ((SocketSessionConfig) session.getConfig()).setTcpNoDelay(true);
//        }
//   
    session.getConfig().setIdleTime(IdleStatus.BOTH_IDLE, 10);
   
    SocketAddress remoteAddress = session.getRemoteAddress();

    server.addClient(remoteAddress);
   
  }
View Full Code Here

Examples of java.net.SocketAddress

   * @param session
   *            the session
   */
  private void blockSession(Channel session)
  {
    SocketAddress remoteAddress = session.getRemoteAddress();
    // logger.warn("Remote address " + remoteAddress +
    // " not in the whitelist; closing.");
    session.close();
  }
View Full Code Here

Examples of java.net.SocketAddress

   *
   * @return true, if is blocked
   */
  private boolean isBlocked(Channel session)
  {
    SocketAddress remoteAddress = session.getRemoteAddress();
    if (remoteAddress instanceof InetSocketAddress)
    {
      if (whitelist.contains(((InetSocketAddress) remoteAddress).getAddress()))
      {
        return false;
View Full Code Here

Examples of java.net.SocketAddress

        return getsockname(getRuntime().getCurrentContext());
    }

    @JRubyMethod(name = {"getsockname", "__getsockname"})
    public IRubyObject getsockname(ThreadContext context) {
        SocketAddress sock = getLocalSocket();
        if(null == sock) {
            throw context.getRuntime().newIOError("Not Supported");
        }
        return context.getRuntime().newString(sock.toString());
    }
View Full Code Here

Examples of java.net.SocketAddress

    public IRubyObject getpeername() {
        return getpeername(getRuntime().getCurrentContext());
    }
    @JRubyMethod(name = {"getpeername", "__getpeername"})
    public IRubyObject getpeername(ThreadContext context) {
        SocketAddress sock = getRemoteSocket();
        if(null == sock) {
            throw context.getRuntime().newIOError("Not Supported");
        }
        return context.getRuntime().newString(sock.toString());
    }
View Full Code Here

Examples of java.net.SocketAddress

    in = new DataInputStream(inStream);
    out = new DataOutputStream(outStream);
  }

  public void reconnect() throws IOException {
    SocketAddress address = socket.getRemoteSocketAddress();
    socket.close();
    socket.connect(address, timeout);
  }
View Full Code Here

Examples of java.net.SocketAddress

        }
        if (con == null) {
            // Not in cache, so create new one and cache it
            try {
                closeSocket(); // Bug 44910 - close previous socket (if any)
                SocketAddress sockaddr = new InetSocketAddress(getServer(), getPort());
                con = new Socket();
                con.connect(sockaddr, getConnectTimeout());
                log.debug("Created new connection " + con); //$NON-NLS-1$
                cp.put(TCPKEY, con);
            } catch (UnknownHostException e) {
View Full Code Here

Examples of java.net.SocketAddress

    }

    public void connect(int connectTimeout, int soTimeout)
           throws UnknownHostException, IOException {
        final String encoding = "ISO-8859-1";
        SocketAddress addr = new InetSocketAddress("localhost", port);
        socket = new Socket();
        socket.setSoTimeout(soTimeout);
        socket.connect(addr,connectTimeout);
        OutputStream os = socket.getOutputStream();
        writer = new OutputStreamWriter(os, encoding);
View Full Code Here

Examples of java.net.SocketAddress

        private Socket socket;
        private Writer writer;
        private CustomReader reader;

        public WebSocketClient(int port) {
            SocketAddress addr = new InetSocketAddress("localhost", port);
            socket = new Socket();
            try {
                socket.setSoTimeout(10000);
                socket.connect(addr, 10000);
                os = socket.getOutputStream();
View Full Code Here

Examples of java.net.SocketAddress

            while (!bufferQueue.isEmpty()) {
                Object encodedMessage = bufferQueue.poll();
               
                // Flush only when the buffer has remaining.
                if (!(encodedMessage instanceof IoBuffer) || ((IoBuffer) encodedMessage).hasRemaining()) {
                    SocketAddress destination = writeRequest.getDestination();
                    WriteRequest encodedWriteRequest = new EncodedWriteRequest(encodedMessage, null, destination);

                    nextFilter.filterWrite(session, encodedWriteRequest);
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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 coftware#gmail.com.