Using dynamic ports (port 0) in TcpListener; how to configure port ranges?

Using dynamic ports (port 0) in TcpListener; how to configure port ranges?

Post by Tligh » Tue, 14 Dec 2004 08:29:47

Hi. I've created a .net service to transfer files from and to a server
from a client. When a file is transferred, the server opens a dynamic
port by suppling port 0 to the TcpListener it's created and then
communicates this port to the client so that the client knows how to
connect (much like passive ftp transfers).

Now when a sysadmin uses this service, is there any way he can control
which port ranges the .net framework or the underlying service provider
(and which provider is that?) uses?

Or is there a better way to get a dynamic port number using the .net

1. Port Range for avoid-v4-udp-ports OR port for resolv.conf nameserver

2. Configure DCOM client to use only a small range of ports (instead of random ports)

I have a question relating to a DCOM client connection to a server.

The scenario is as follows. The server is behind a firewall.
The server brokers a connection using port 135.

The firewall configuration allows all ports out to be open, but only
selected incoming ports. Incoming port 135 has been configured to be
open on the firewall.
The client connects to the server via a random port. With the above
configuration, the client is unable to connect through the firewall.

Is there a way of configuring the port that the client uses to stop it
connecting via a random port?? I would like to configure the client to
use 1 (or a small range) of ports only.

any advice would be much appreciated

3. Port numbers, dynamic range and administrator-only ports

4. I2C through PC parallel port, serial port and/or USB port - please help

5. Ports....Ports....Ports...

6. Configuring DCOM to use a different port than the default port 135

7. USB001 Virtual printer port vs USB002 Local port vs USB003 Virtual printer port ????

8. how to port forward from one port to other port

9. ISA Server Port Forwarding port 80 --> port 888

10. Missing port types : local port and Standard TCP/IP port

11. netscreen: not allowed to port forward port outside port < 1024 to one inside >= 1024?

12. Configure muliple ports under port exceptions on XP Firewall

13. Port review request: ports/124770, ports/124771

14. Port forwarding ranges of ports in IOS

15. Port forwarding a range of ports