Thursday, 8 June 2017

How multi processes bind to one udp port

I have two applications, one is C-Based, one is NodeJs-Based. Two apps need process UDP message from same port in one Centos machine. Is it possible to have 2 programs that bind to same UDP port and take message simultanously?

In NodeJs, I used dgram:

dgram.createSocket({type: "udp4", reuseAddr: true})

And in C, I use SO_REUSEADDR, SO_REUSEPORT parameter for setting socket.

The problem is: I can not receive any UDP message in application started later. That means only one application can receive UDP message. Any help is really appreciate. Thanks



via hoang

No comments:

Post a Comment