Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Socket client unable to contact server on local host

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...!");
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic