Package java.net

Examples of java.net.Socket.shutdownOutput()


    this.flush0();
    // try to close output first
    Socket socket = ((SocketChannel) this.selectableChannel).socket();
    try {
      if (!socket.isClosed() && !socket.isOutputShutdown()) {
        socket.shutdownOutput();
      }
      if (!socket.isClosed() && !socket.isInputShutdown()) {
        socket.shutdownInput();
      }
    } catch (Exception e) {
View Full Code Here


                sock.setSoLinger(false, -1);
                sock.setSoTimeout(1000);
                sock.setTcpNoDelay(true);
                sock.getOutputStream().write("isro".getBytes());
                sock.getOutputStream().flush();
                sock.shutdownOutput();
                BufferedReader br = new BufferedReader(
                        new InputStreamReader(sock.getInputStream()));
                result = br.readLine();
                sock.close();
                br.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

      public void run() {
        while (true) { // fetching does a few retries
          try {
            Socket s = socket.accept();
            s.getOutputStream().write(1234);
            s.shutdownOutput();
          } catch (Exception e) {
            break;
          }
        }
      }
View Full Code Here

        while ((b=fis.read()) != -1){
            os.write(b);
        }
        sendLine("bsh.prompt=\"bsh % \";",os);// Reset for other users
        os.flush();
        sock.shutdownOutput(); // Tell server that we are done
    }

    private static void sendLine( String line, OutputStream outPipe )
    throws IOException
    {
View Full Code Here

        while ((data = requestMsgInStream.read()) != -1) {
            System.out.print(data);
            outStream.write(data);
        }
        outStream.flush();
        socket.shutdownOutput();
        BufferedReader reader = new BufferedReader(new InputStreamReader(socket
                .getInputStream()));
        StringBuffer sb = new StringBuffer();

        String response = reader.readLine();
View Full Code Here

            ;
        }
       
        try{
            if (!socket.isOutputShutdown()){
                socket.shutdownOutput();
            }
        } catch (IOException ex){
            ;
        }
View Full Code Here

    this.flush0();
    // try to close output first
    Socket socket = ((SocketChannel) this.selectableChannel).socket();
    try {
      if (!socket.isClosed() && !socket.isOutputShutdown()) {
        socket.shutdownOutput();
      }
      if (!socket.isClosed() && !socket.isInputShutdown()) {
        socket.shutdownInput();
      }
    } catch (Exception e) {
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.