Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

TCP socket fails with "error ECONNREFUSED" #20128

Closed
humblewizard opened this issue Apr 24, 2015 · 1 comment
Closed

TCP socket fails with "error ECONNREFUSED" #20128

humblewizard opened this issue Apr 24, 2015 · 1 comment

Comments

@humblewizard
Copy link

It doesn't matter the port #. I had this working on a different Linux box with the same setup. I have an http server in the same thread on a 1 second delayed start up that works fine. I'm starting nodejs with SU. Is there something obviously broken here?

var net =  require("net"),
    TCP_sock, 
    TCP_port = 2950, 
    TCP_host = 'localhost',
    TCP_socket = net.createConnection(TCP_port, TCP_host);
TCP_socket.on('data', takeData)
    .on('connect', function(sock) {
       TCP_sock = sock;
       console.log("\033[60A\033[18B" + 'connected on port: ' +  TCP_port + ' of '  +  TCP_host);
    })
    .on('error',function(e){
        console.log("\033[60A\033[17B" + 'Failed to connect on port: ' +  TCP_port + ' of '  + TCP_host);
        console.log("\033[60A\033[18B--" + e);
    })  
   .on('end', function() {
            console.log('closed');
   });  

  function takeData(wpinfo){
      console.log("Waypoint info:" + wpinfo);
  }
@misterdjules
Copy link

What do you mean by:

I have an http server in the same thread on a 1 second delayed start up that works fine

?
Could you please provide us with a complete but minimal code sample that would allow us to reproduce the issue?

@Trott Trott closed this as completed Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants