0

I have an application on my fedora machine that sends SIP requests to the server. The application chooses a random source port to send the requests. Is there some way I can force the application to use a specific port (say 15000). Can I, maybe, block the application from using all other ports (and then it will have to choose a single source port)?

Thanks in advance.

Rishabh
  • 199
  • 3
  • 14

1 Answers1

0

You need to bind before connect or send. See here:

binding a port number to a TCP socket (outgoin) to send packets

I think it works the same for UDP.

Community
  • 1
  • 1
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • I cannot change the SIP application. It sends SIP requests over TCP, and for the source port the application will choose a random port which is not configurable by any option. But I need the application to choose a specific port. Is there any workaround for this? – Rishabh Aug 26 '14 at 12:15
  • If you aren't allowed to change the code, then this is not a programming question. I suggest you take it to SuperUser. – John Zwinck Aug 26 '14 at 12:17