Package java.net

Examples of java.net.ServerSocket.accept()


        try {
            // Set the timeout to 1ms as all we care about is if it throws an
            // SSLException on accept.
            socket.setSoTimeout(1);

            socket.accept();
            // Will never get here - no client can connect to an unbound port
        } catch (SSLException ssle) {
            // SSL configuration is invalid. Possibly cert doesn't match ciphers
            IOException ioe = new IOException(sm.getString(
                    "jsse.invalid_ssl_conf", ssle.getMessage()));
View Full Code Here


        }

        try {
            while (true) {

                Socket s = server.accept();
                try {
                    String command = readLine(s);
                    log.info(s.getRemoteSocketAddress() + ">" + command);

                    if (COMMAND_STOP.equals(command)) {
View Full Code Here

        }
      }
    });
    t.setDaemon(true);
    t.start();
    Socket socket = server.accept();
    socket.setSoTimeout(5000);
    InputStream is = socket.getInputStream();
    MindRpcSerializer serializer = new MindRpcSerializer();
    MindRpcMessageHolder holder = serializer.deserialize(is);
    String content = new String(holder.getContent());
View Full Code Here

      // Open a socket to listen on.
      ServerSocket serverSocket = new ServerSocket(SERVER_PORT);
      System.out.println("Socket started on port " + SERVER_PORT);

      // Wait (blocking) for an incoming connection
      socket = serverSocket.accept();
      System.out.println("Client connected");

      // Setup the streams
      out = new PrintStream(socket.getOutputStream(), true);
      in =
View Full Code Here

          port++;
        }
      }
     
      while (true) {
        Socket connection = server.accept();
       
        MineProxyHandler handler = new MineProxyHandler(this, connection);
        handler.start();
      }
    } catch(IOException e) {
View Full Code Here

                Socket socket = null;

                try {
                    serverSocket = new ServerSocket(port);
                    serverSocket.setSoTimeout(timeoutInMs);
                    socket = serverSocket.accept();
                    BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                    container.value = in.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
View Full Code Here

  }
 
  public synchronized IInteger createListener(IInteger socketId) {
    ServerSocket ss = serverSockets.get(socketId);
    try {
      Socket cs = ss.accept();
      PrintWriter out = new PrintWriter(cs.getOutputStream(), true);
      BufferedReader in = new BufferedReader(new InputStreamReader(cs.getInputStream()));
      clientSockets.put(socketCounter,  cs);
      socketWriters.put(socketCounter,  out);
      socketReaders.put(socketCounter,  in);
View Full Code Here

            {
                while (!stopped.get())
                {
                    try
                    {
                        read.execute(new Reader(socket.accept()));
                    }
                    catch (IOException e)
                    {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
View Full Code Here

        try {
            while (true) {

                final Socket s;
                try {
                    s = server.accept();
                } catch (IOException ioe) {
                    // accept terminated, most probably due to Socket.close()
                    // just end the loop and exit
                    break;
                }
View Full Code Here

        vmb.args().add("-connectTo", "localhost:" + serverSocket.getLocalPort());

        // TODO add XVFB options here
        Proc p = vmb.launch(new LocalLauncher(listener)).stdout(listener).envs(envVariables).start();

        Socket s = serverSocket.accept();
        serverSocket.close();

        return Channels.forProcess("Channel to " + displayName, Computer.threadPoolForRemoting, new BufferedInputStream(new SocketInputStream(s)),
                new BufferedOutputStream(new SocketOutputStream(s)), null, p);
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.