Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. WinSock: Dynamic Port Allocation

WinSock: Dynamic Port Allocation

Scheduled Pinned Locked Moved C / C++ / MFC
wpfwcfjsonquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Oliver Anhuth
    wrote on last edited by
    #1

    The MSDN for the WinSock bind API call states:

    For TCP/IP, if the port is specified as zero, the service
    provider assigns a unique port to the application with a
    value between 1024 and 5000.
    ..
    Binding to a specific port number other than port 0 is
    discouraged for client applications, since there is a
    danger of conflicting with another socket already using
    that port number.

    Unfortunately it does not say when the allocated port number is released. When using this technique I always get the last port number increased by one. Does that mean that this method can only succeed up to 3976 times and will then fail? Or will the port number start again with 1024 after 5000 has been reached? In summary: Does anybody know more about this feature or have some references? Oliver

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups