B
bughunter
Hi,
When providing the HttpListener with a list of 'prefixes' to respond to
there doesn't appear to be an option for binding to an arbitrary freely
available port, and if there is then there doesn't seem to be a
mechanism for discovering that port by the calling code.
I'm happy to be proven wrong here but given this situation, the obvious
approach now would be to programatically query the OS for a list of
used and/or available ports, and to pick one of the available ones.
This may introduce the problem of a port being allocated in the time
between querying the OS and binding to the port, but I can handle that
exception and keep trying until a successful bind occurs (hopefully!).
Am I going about this the right way? Is there an alternative to
HttpListener? I suppose I could revert to using HttpListener and
perhaps re-using the provided HTTP classes for handling the HTTP
protocol?
Thanks in advance for any help,
Colin Green
When providing the HttpListener with a list of 'prefixes' to respond to
there doesn't appear to be an option for binding to an arbitrary freely
available port, and if there is then there doesn't seem to be a
mechanism for discovering that port by the calling code.
I'm happy to be proven wrong here but given this situation, the obvious
approach now would be to programatically query the OS for a list of
used and/or available ports, and to pick one of the available ones.
This may introduce the problem of a port being allocated in the time
between querying the OS and binding to the port, but I can handle that
exception and keep trying until a successful bind occurs (hopefully!).
Am I going about this the right way? Is there an alternative to
HttpListener? I suppose I could revert to using HttpListener and
perhaps re-using the provided HTTP classes for handling the HTTP
protocol?
Thanks in advance for any help,
Colin Green