Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Socket client unable to contact server on local host  RSS feed

John Pa
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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) {
"Could not connect to server, aborting...!");
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!