Timothy O'Connell
Timothy O'Connell

Reputation: 89

Java socket crashes client or server?

OK, so I am completely new to Java sockets, I don't really know the issue and my good friend told me to post this here.

Client: http://www.pastie.org/4163360

Server: http://www.pastie.org/4163364

Errors received when I run the client:

Exception in thread "main" java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at talk.Client.main(Client.java:36)

Upvotes: 1

Views: 5148

Answers (1)

Dedawn
Dedawn

Reputation: 80

Ran your code - had to change the IP of the host, but otherwise all good. Therefore, can confirm this is an IP/Firewall issue. Double check your ipconfig / ifconfig for your IP address. Sorry, but can't comment on questions yet :(

Upvotes: 2

Related Questions