Hey everyone! So I want to make a simple console based chat client as my first java project (ambitious I know) so here is what I have brain stormed as to What this program will entail (Let me know if I missed anything.

  • Cases (to handle arguments such as Server IP, disconect, Username)
  • Network code (duh)
  • client program
  • Server Program
  • Server must handle Who the message is intended for and what their current IP is
  • Lots of patients and frustration (also testing)

so If you have any words of encouragement or any good advice let me know

Welcome, and we all wish you great success with your project.
Without knowing more about your current level of expertise its hard to offer relevant advice, but maybe these two mantras will add to the obvious O.O. stuff...
Test early and test often. Depending on your experience level try to test every 10-40 lines of code. 10% extra work on early testing will save you 50% work trying to debig big blocks of new code with mutiple bugs hiding each other.
Its all about method signatures. If you get the method signatures right (right parameters, right return type, name exactly describes what it does) then your whole application will hang together properly. The code inside the methods may be incomplete, buggy, slow... but those are easy to fix one at a time.

So this is my code so far

import java.io.*;
 public class ChatSwitchTest {
    public static void main(String[] args) {
    System.out.print("Enter server IP: ");
    //Is there an easier way to do this??
       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String option = null;
        String userName = null;
        String ip = null;
        try{
            ip = br.readLine();
            } catch (IOException e) {
         System.out.println("Error!");
         System.exit(1);
       }
       //code to handle if connection was successful
       //this code is only as a place holder
       System.out.println("Connected!");
       System.out.print("Desired User Name: ");
            try{
            userName = br.readLine();
            } catch (IOException e) {
         System.out.println("Error!");
         System.exit(1);
       //code to check with server if username is taken
       System.out.println("Username is Taken");
           }}}

As my comment says I am wondering if there is an easier way to do this? also I am asuming that there is network code to handle things such as IP input and things.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.