Package java.net

Examples of java.net.Socket.shutdownOutput()


        try{
            Socket s = new Socket(InetAddress.getLocalHost(), _port);
            OutputStream out = s.getOutputStream();
            out.write((_key+"\r\nstop\r\n").getBytes());
            out.flush();
            s.shutdownOutput();
            s.close();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
View Full Code Here


            try (Socket sock = new Socket(host, port)) {
                OutputStream outstream = sock.getOutputStream();
                outstream.write(cmd.getBytes());
                outstream.flush();
                // this replicates NC - close the output stream before reading
                sock.shutdownOutput();

                try (BufferedReader reader = new BufferedReader(
                        new InputStreamReader(sock.getInputStream()))) {
                    StringBuilder sb = new StringBuilder();
                    String line;
View Full Code Here

        {
          log.fine("shutting down");
          state = Connection.CLOSING;
          Socket sock = sc.socket();
          try {
            sock.shutdownOutput();
          } catch (IOException se) {
            log.severe("shutdown failed: " + se.getMessage());
            log.log(Level.FINE, "details: ", se);
          }
        } else
View Full Code Here

  }

        // Close the streams and the socket.
        try {
      objectOut.flush();
      socket.shutdownOutput();
            objectOut.close();
            out.close();
      objectIn.close();
            socket.close();
        } catch (IOException e) {
View Full Code Here

            }

      // Close the various streams and the socket.
            try {
    objectOut.flush();
    socket.shutdownOutput();
    socket.shutdownInput();
                objectOut.close();
                out.close();
                objectIn.close();
                in.close();
View Full Code Here

                // then this inner class should be renamed "DataServer".

                // Close the various streams and the socket itself.
                try {
        objectOut.flush();
        socket.shutdownOutput();
        socket.shutdownInput();
                    objectOut.close();
                    objectIn.close();
                    out.close();
                    in.close();
View Full Code Here

      assertNull( dh.xsender );
      assertNotNull( dh.xbuf );
      assertEquals( 1, dh.xbuf.length );
      assertEquals( (byte) i, dh.xbuf[0] );

      t.shutdownOutput();
      t.close();
      t = null;
     
      assertWhat( What.DOWN, dh.what );
    }
View Full Code Here

     
//      Log.report( "t.reading" );
      assertEquals( -1, t.getInputStream().read() );
//      Log.report( "t.eof" );
     
      t.shutdownOutput();
      t.close();
      t = null;
     
      assertWhat( What.DOWN, dh.what );
//      Log.report( "down" );
View Full Code Here

   
    assertWhat( What.UP, dh.what );
    assertNull( dh.xsender );
    assertNull( dh.xbuf );
   
    t.shutdownOutput();
   
    assertWhat( What.DOWN, dh.what );
    assertNull( dh.xsender );
    assertNull( dh.xbuf );
   
View Full Code Here

                {
                    // TODO - is this really required?
                    Socket socket= ((SocketChannel)_channel).socket();
                    try
                    {
                        socket.shutdownOutput();
                    }
                    finally
                    {
                        socket.close();
                    }
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.