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

feature request: bind a special local address in net.connect (as a tcp client) #2285

Closed
qyb opened this issue Dec 7, 2011 · 11 comments
Closed
Labels

Comments

@qyb
Copy link

qyb commented Dec 7, 2011

tcp server.listen support bind(), but tcp client has no such feature.

in net.js
exports.connect = exports.createConnection = function(port /* [host], [cb] */) {
var s;

if (isPipeName(port)) {
s = new Socket({ handle: createPipe() });
} else {
s = new Socket();
}

return s.connect(port, arguments[1], arguments[2]);
};

@bobrik
Copy link

bobrik commented Dec 7, 2011

Really? Did you ever try?

@bobrik
Copy link

bobrik commented Dec 7, 2011

Btw, I suggest you to learn some basics of Github markup, looks really great for some code:

var net = require("net");

net.createConnection(80, "google.com", function() {
    console.log("hi there!");
})

@qyb
Copy link
Author

qyb commented Dec 7, 2011

@bobrik, please notice I mention here is "bind local address", not "connect remote google's 80 port"

@bnoordhuis
Copy link
Member

Yes, it's not possible to bind a client socket to a local address right now. It's high on my 'things to do when I have an hour to kill' list.

@mabels
Copy link

mabels commented Dec 7, 2011

Hey

you closed the issue but i don't see my or any patch which is related to this issue, has been integrated into the node codebase.
What i missed

cheers

meno

@bnoordhuis
Copy link
Member

What i missed

Nothing so far. #987 doesn't apply to v0.6, that's why I closed it. I want to implement it in the near future.

@mabels
Copy link

mabels commented Feb 19, 2012

When will the "near future" give me the local bind feature?

cheers

meno

@bnoordhuis
Copy link
Member

When will the "near future" give me the local bind feature?

When either a) one of the maintainers finds the time to implement it, or b) someone submits a patch.

@mabels
Copy link

mabels commented Feb 20, 2012

i offert to make the patch.

But i'am not willing to do the work and later on to get rejected again.

cheers

meno

@bnoordhuis
Copy link
Member

i offert to make the patch. But i'am not willing to do the work and later on to get rejected again.

Submit a high-quality patch and there's a good chance of it getting landed. Check out the Contributing wiki page.

@qyb
Copy link
Author

qyb commented Mar 16, 2012

node 0.7.6

net, http, https: add localAddress option (Dmitry Nizovtsev)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants