ZAX
ZAX

Reputation: 1008

Java Socket Chat in Eclipse

I'm trying to implement a websocket chatroom type of interface. Everything compiles, but when I run the code I get an error on the client side actually connecting to the server.

I've found this question: Run two Java programs from Eclipse at once? and thought that this was my issue. However even after running the programs as they suggest, (pinning the consoles and such) I still get an error about the connection.

The only thing I can think of is possibly some firewall setting I have on my system (running on localhost) that I might need to change? Other than that maybe someone can help me understand why the connection is not working?

public class EchoServer
{
    public static final int LISTENING_PORT = 19903;
    public static final int MAX_CLIENTS = 4;

Client:

public class Client
{
    public static final String SERVER_HOSTNAME = "localhost";
    public static final int SERVER_PORT = 11516;

Upvotes: 0

Views: 1033

Answers (1)

Luca Mastrostefano
Luca Mastrostefano

Reputation: 3271

In the Client class the variable SERVER_PORT should be equal to variable LISTENING_PORT in the EchoServer class.

Upvotes: 1

Related Questions