Java chat client connecting to server
<p>I have created a chat server that works with telnet. Now, I am trying to write my own client. I need to be able to get an IP address from the user and a port number. I am trying to pass those variables through the ChatClient(). However, when I compile the following code, I receive the following error message: </p>

<pre><code>ChatClient.java:24: cannot find symbol
symbol  : variable ip
location: class ChatClient
            new ChatClient(ip,port);
                           ^
ChatClient.java:24: cannot find symbol
symbol  : variable port
location: class ChatClient
            new ChatClient(ip,port);
                          ^
2 errors
</code></pre>

<p><strong>ChatClient.java</strong></p>

<pre><code>public class ChatClient {
    PrintWriter output;
    BufferedReader input;
    Socket client;

    public ChatClient(int ip, int port) throws Exception {
        String line;
        input = new BufferedReader( new InputStreamReader( client.getInputStream()) ) ;
        output = new PrintWriter(client.getOutputStream(),true);
        output.println("Enter an ip address: ");
        line = input.readLine();
        output.println("Enter a port number: ");
        line = input.readLine();
    }

    public static void main(String ... args) {
        try {
            new ChatClient(ip,port);
        } catch(Exception ex) {
            out.println( "Error --&gt; " + ex.getMessage());
        }

    } // end of main        

}
</code></pre>
