4

Normally I could set the dynamic/ephemeral port range using netsh:

http://www.windowsnetworking.com/kbase/WindowsTips/WindowsServer2008/AdminTips/Admin/DefaultDynamicPortRange.html

However, netsh doesn't seem to exist in CE 7. It it a catalog item I've not found yet? Can I achieve the same thing with the registry and if so how?

Edit: I'm developing an application in C++. It's possible to specify an individual port binding by using bind() before connect(). However, this has two disadvantages; I need to come with my own scheme for allocating numbers, and if it happens to use a port that is in the TIME_WAIT state then bind will succeed and connect will fail.

I've seen references to an API for creating private port reservations in Win32, but this doesn't appear to be present in CE 7.

3
  • 1
    This is a good question but unfortunately an Off topic question for SO.
    – ρss
    Sep 8, 2014 at 8:08
  • Possibly, it's on the boundary of systems administration; although if the answer turns out to be "you need to call this API from this DLL" then it would be on-topic.
    – pjc50
    Sep 8, 2014 at 8:28
  • Asking for external resources (libraries/API) is also off topic! Please put some code in your question then it would be on topic. OR You can add information like for which programming/scripting language you are looking for a solution. Eg: Batch/Bash/Python Then add some language tags to your question too, it would be helpful. You are lucky that a question that has an bounty can't be closed by flgging. :)
    – ρss
    Sep 8, 2014 at 9:49

1 Answer 1

0

you need to modify the register. ceRegistreEcrit("HKEY_LOCAL_MACHINE\Comm\CF8385PN1\Parms\TcpIp","IpAddress",New_Ip)

3
  • That particular entry changes the local IP address, not the source ports for outgoing connections.
    – pjc50
    Sep 8, 2014 at 10:27
  • and if you add something like ceRegistreEcrit("HKEY_LOCAL_MACHINE\Comm\CF8385PN1\Parms\TcpIp","IpAddress",10.10.10.10:2001) that's works? did you see this link : www-01.ibm.com/support/docview.wss?uid=swg21402388
    – user1990
    Sep 15, 2014 at 9:14
  • 1. Start Registry Editor (Regedit.exe). 2. Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters 3. On the Edit menu, point to New, and then click Multi-string Value. 4. Right-click the new value, click Rename, type ReservedPorts, and then press ENTER. 5. If I want to restrict the range of dynamically allocated ports to 2000-2049, I will need to specify the ports that are to be blocked (reserved), 1024-1999 and 2050-5000. Double-click the ReservedPorts value, type the range of ports that you want to reserve.
    – user1990
    Sep 15, 2014 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.