Forums Register Login

Socket client unable to contact server on local host

+Pie Number of slices to send: Send
Hi guys,

I am running a server on the local host and want my client to connect to it.It is unable to connect and I get a connection refused error.I was running a firewall which I shutdown and tried but still did not make any headway.
The code is as below
-------------------------------------------
try { // initialize socket
this.remoteAddr = remoteAddr;
this.port = port;
socket = new Socket(remoteAddr, port);
out = new PrintStream(socket.getOutputStream());
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
}
catch (Exception e) {
System.out.println(e);
JOptionPane.showMessageDialog(null,
"Could not connect to server, aborting...!");
System.exit(0);
}
----------------------------
She's brilliant. She can see what can be and is not limited to what is. And she knows this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1076 times.
Similar Threads
Connection Refused Error
java.net.ConnectException: Connection timed out: connect
RMI Callback using socket pools
Pinging IP Addresses...
Java Server, PHP client
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:06:42.