Sign in to follow this  
Followers 0
susu6514

Use specific source port number

5 posts in this topic

Hi,

I'm wondering if we can make the TCP/UDP to use a specific source port number to connect to the server.

And on server side, if we can know the client's source port if they are connected to our server and reject or accept some ports.

Thanks in advance.

Su

Share this post


Link to post
Share on other sites



Yes, I did. My environment is like this

PC1(Send TCP or UDP) ------>NAT Gateway --------> PC2(Receive TCP or UDP packets)

When PC1 sends the packets through NAT device, the source port will be translated to other ports.

What can I do to know the source port sent from NAT on PC2?

Thank you.

Share this post


Link to post
Share on other sites

Not sure I get what you mean. Usually when you bind a tcp connection to a port and establish a connection with a remote computer/server you will both be communication on the same port. So if you're accepting connections on port 50 both the server and client are using port 50.

Share this post


Link to post
Share on other sites

To be more correctly, I'd like to do

PC1(Src port 1024) ------>NAT Gateway (Src port 49152)--------> PC2(Receive TCP or UDP packets)

From PC2, I'd like to know the incoming port is 49152 and I'd like to show it to the users and maybe send back to port 49152.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0