Results 1 to 3 of 3
  1. #1
    Uppoy is offline Member
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Default Logging out (Closing sockets)

    What I got atm:

    Java Code:
        public static void logout() {
            loggedIn = false;
            setDefaults();
            try {
                if (socket != null) {
                    socket.close();
    		socket = null;
                }
    
            } catch (IOException ioe) {
            }
        }
    Logging out works, though when I try to log back in, it closes the socket again.
    If I remove "socket = null;" it will log back in, but then the socket won't be closed. (two accounts in once logged in).

    Thanks in advance,

    Uppoy.

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default

    Show us the code for "try to log back in".

  3. #3
    ra4king's Avatar
    ra4king is offline Senior Member
    Join Date
    Apr 2011
    Location
    Atlanta, Georgia, US
    Posts
    396
    Rep Power
    4

Similar Threads

  1. closing the use of a resource
    By jayragz in forum New To Java
    Replies: 14
    Last Post: 05-17-2011, 04:24 PM
  2. BufferedReader closing by itself (not what i want)
    By Sneaky Fox in forum Threads and Synchronization
    Replies: 2
    Last Post: 02-27-2011, 05:43 AM
  3. Closing 1 Desktop App, But Not The Other
    By longphant in forum AWT / Swing
    Replies: 4
    Last Post: 08-25-2010, 10:38 PM
  4. closing FileOutputStream?
    By mgrootsch in forum New To Java
    Replies: 1
    Last Post: 05-17-2010, 05:36 PM
  5. Replies: 5
    Last Post: 06-26-2008, 03:16 AM

Posting Permissions

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