I am building a client server application using c sharp. The server uses a tcplistener with a fixed port number. the client connects to the server using tcpclient. After connecting, the client and server exchange data using this connection. The application then creates a new udp connection to send and receive the message. Since the server allows multiple connections from one client, I have to distinguish between each connection to a different port. To do this, I must first 1. On the server, create udpclient (automatically use the unused udp port on the server). 2. Sends the port number used by the udpclient server to the client. 3. The client sends data to the server using the specified port number.
The problem is how to create udpclient, where can you find out the port number that is being used?
source
share