![]() ![]() I've been toying with ZeroMQ, and one major limitation is the absence of the ipc:// transport on Windows. You may be curious as to why I wish to do something so odd. This has two problems: 1) I'd rather not bind at all until the second process comes along 2) there's a small time interval during which a third party could accidentally (or deliberately) usurp the port. Or, putting it another way, I want one process to start the bind-to-port-zero operation - immediately learning the port number that will be used - and let a nominated second process complete the bind operation sometime in the future.Īt the moment, the closest work-around I can think of is for the first process to bind to address/0 immediately, and stay bound until the second process requests it, at which point it unbinds and tells the other process the port number it acquired, which then binds to the address/port explicitly. This means not just avoiding accidental random allocation of that port number, but also preventing any other process from binding to the same address/port in the interim. ![]() What I really want is to separate the allocation of a dynamic port number from the bind-to-port-zero operation. It's OK for the first process to acquire a random port number, and pass it to the requesting process.ĮDIT: It occurs to me that my question is somewhat poorly stated. ![]() The port number needn't be determined in advance. How can a process reserve a port without actually binding/listening to it, and then safely (i.e., avoiding race-conditions) hand it over to another process on request? I know this is possible via the registry and a reboot, but I would like to avoid such a heavy-handed solution. I'd like to reserve a TCP port, to be bound by a service later, so that Windows doesn't inadvertently use the same number when assigning random port numbers. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |