Results 1 to 3 of 3
  1. #1
    Wnt2bsleepin is offline Senior Member
    Join Date
    Feb 2012
    Posts
    219
    Rep Power
    3

    Default Chat Server won't print out what it's supposed to with certain input.

    Sorry for the bad wording, but I had no idea how to word it. Basically, I followed the java tutorial on networking and made my own customized chat server. The problem seems to be simple in its solution, but I cannot seem to get it to work. I have a portion of the code that loops through the input, and as long as it does not equal "Quit" or null, it continues the loop and prints out what was sent to the server.


    Java Code:
    while((inputLine = in.readLine()) != null)
    			{
    				out.println(inputLine);
    				if(inputLine.equalsIgnoreCase("Quit"))
    						break; 
    				if(inputLine.equalsIgnoreCase("list")) out.println("Number of people in the server: " + numPeople); 
    			}
    My problem is that it seems to be ignoring it. I type in Quit or list and it doesn't do what I want it to do. Any help is appreciated. Thanks!

  2. #2
    k1ng is offline Member
    Join Date
    Apr 2012
    Posts
    59
    Rep Power
    0

    Default Re: Chat Server won't print out what it's supposed to with certain input.

    What does it do instead?

  3. #3
    Wnt2bsleepin is offline Senior Member
    Join Date
    Feb 2012
    Posts
    219
    Rep Power
    3

    Default Re: Chat Server won't print out what it's supposed to with certain input.

    It was ignoring it. I figured it out though thanks. I had the server print out the nickname, but I did it in a way that caused the string being passed to the server to be formatted improperly. Thanks.

Similar Threads

  1. Help Needed! Android chat - pc chat server
    By thornt in forum Android
    Replies: 3
    Last Post: 04-13-2012, 12:50 PM
  2. Replies: 3
    Last Post: 03-08-2012, 01:09 AM
  3. Chat Server
    By mrbrendano in forum New To Java
    Replies: 1
    Last Post: 09-19-2011, 11:08 PM
  4. midlet chat server
    By nfitte in forum Networking
    Replies: 0
    Last Post: 07-09-2009, 09:08 AM
  5. simple chat server
    By sari in forum New To Java
    Replies: 0
    Last Post: 02-06-2009, 02:30 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
  •