1

My application consists of a UDP server receiving high traffic.

I am thinking to increase the capacity throughput of the application and threading is not an option. So multiple instances of the same process is considered.

I was thinking whether it is possible to reuse the exact same UDP socket for sending out traffic between two different processes. I am interested only for sending since receiving is handled in another way.

Will setting option on socket to SO_REUSEADDR help here?

Qantas 94 Heavy
  • 14,790
  • 31
  • 61
  • 78
nikpel7
  • 630
  • 4
  • 11
  • possible duplicate of [Socket options SO\_REUSEADDR and SO\_REUSEPORT, how do they differ? Do they mean the same across all major operating systems?](http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t) – user207421 Jan 21 '14 at 23:29

1 Answers1

4

You can not create two servers in two different process because second request for binding on same port will be failed so you have to use SO_REUSEPORT option which allows socket to bind follow Let two UDP-servers listen on the same port? for your reference.

Community
  • 1
  • 1
Rahul R Dhobi
  • 5,180
  • 24
  • 37
  • 1
    http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t – selbie Jan 21 '14 at 11:17
  • Even if SO_REUSEPORT/SO_REUSEADDR to bind the sockets, are there any issues that can arise from this approach. For example what will happen when two processes will try to send a message at the same time, is this something that I should consider? – nikpel7 Jan 21 '14 at 11:22
  • I am considering downvoting this answer. See for example: http://stackoverflow.com/questions/670891/is-there-a-way-for-multiple-processes-to-share-a-listening-socket – Jonathan Ben-Avraham Jan 21 '14 at 11:22
  • @JonathanBen-Avraham Your link is about TCP. This question and answer are about UDP. – user207421 Jan 21 '14 at 23:28