Sahib Yar
Sahib Yar

Reputation: 1046

pass paramters in net.Socket.connect

I am new to JavaScript and NodeJS, came from C++ background.

TCP client connect is working fine and connected successfully to nc -l 5010 with following code

function connect(p_port, p_ip) {
  client.connect(5010, '0.0.0.0', function() {
...
});
}

but not with following code

var v_port = 5010;
var v_ip = '0.0.0.0';

function connect(p_port=v_port, p_ip=v_ip) {
  client.connect(p_port, p_ip, function() {
...
});
}

what I am doing wrong regarding passing arguments.

Upvotes: 1

Views: 85

Answers (1)

Sahib Yar
Sahib Yar

Reputation: 1046

After 2 hours of debugging found that, p_ip parameter name was conflicting with other variable.

Upvotes: 1

Related Questions