View Single Post
  #4 (permalink)  
Old 12-01-2007, 09:09 PM
staykovmarin staykovmarin is offline
Senior Member
 
Join Date: Nov 2007
Location: Newport, WA
Posts: 141
staykovmarin is on a distinguished road
You are closing the socket (obviously, judging by the error)
Code:
while (!done) { String line = in.readLine(); String next = null; String[] temp; System.out.println(line); if (line.trim().equals("login")) { next = "login"; out.println("login"); } if (line.trim().equals("BYE")) done = true; if (next == "login") { temp = line.trim().split(":"); out.println("Welcome " + temp[0]); } incoming.close(); }
incoming.close();? You are closing that at the end of the while loop? Should it not be called right AFTER the while loop is done executing? This way you are closing the stream after each time the loop executes, which is not whatyou want.
Reply With Quote