Results 1 to 2 of 2
  1. #1
    dim_ath is offline Member
    Join Date
    Jan 2008
    Posts
    14
    Rep Power
    0

    Question how can i disconnect client?

    hello everyone!

    can anyone help me on how client can be disconnected immediately when receive message from the server?



    do {


    try {

    String *message*= input.readUTF();
    displayArea.append( "\n" + message );

    displayArea.setCaretPosition(
    displayArea.getText().length() );
    }

    catch ( IOException ioException ) {
    displayArea.append( "\nUnknown object type received" );
    }

    } while ( message!=1 );

    displayArea.append( "\nClosing connection.\n" );

    // close streams and socket
    output.close();

    input.close();

    client.close();

    displayArea.append( "Connection closed." );

  2. #2
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    Location
    NewEngland, US
    Posts
    835
    Rep Power
    9

    Default

    close() should work for you... just for kicks - what are output, input and client's type?
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

Similar Threads

  1. Client IP Address
    By goodjonx in forum Networking
    Replies: 3
    Last Post: 09-23-2009, 11:27 AM
  2. UDP Client help
    By misslilbit02 in forum Advanced Java
    Replies: 0
    Last Post: 03-09-2008, 08:31 PM
  3. Identify Client in Socket Client Server Application
    By masadjie in forum Networking
    Replies: 1
    Last Post: 12-20-2007, 10:18 AM
  4. ThinkUI SQL Client 1.0.1
    By levent in forum Java Software
    Replies: 0
    Last Post: 07-26-2007, 09:18 PM
  5. client for PERFORCE
    By Ed in forum New To Java
    Replies: 2
    Last Post: 07-02-2007, 08:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •