Can Two Programs Monitor the Same UDP Message?

Discussion in 'Amateur Radio Software' started by EI8IC, Oct 30, 2020.

ad: L-HROutlet
ad: l-rl
ad: L-MFJ
ad: Subscribe
ad: Left-3
ad: Left-2
ad: abrind-2
  1. K6CLS

    K6CLS Ham Member QRZ Page

    Untagged HTML is displayed with leading spaces removed. Trailing spaces too.
  2. AA6YQ

    AA6YQ XML Subscriber QRZ Page

    Continuously broadcasting a transceiver's frequency to multiple client applications is a fine application for UDP: if one message is dropped, another will soon be along.

    For messages that must be delivered -- like one bearing a QSO to be logged -- UDP is inappropriate unless you add an acknowledgement and retry-on-timeout mechanism.
    KA9JLM likes this.
  3. KA9JLM

    KA9JLM Ham Member QRZ Page

    Exactly what would the data be ?

    Using UDP for radio control could be problematic.
  4. K6CLS

    K6CLS Ham Member QRZ Page

    Why does N1MM offer (whatever) over multicast UDP?

    ... We'd both like to hear from the OP
  5. KA9JLM

    KA9JLM Ham Member QRZ Page


    What 2 separate programs would that be ?

    Are you working with a Windows OS ?
  6. AA6YQ

    AA6YQ XML Subscriber QRZ Page

    The OP states that he is using and wants to enable multiple clients to consume N1MM UDP broadcasts from the same port.

    In summary:

    - set the socket's SO_BROADCAST and SO_REUSEADDR options

    - use a multicast address
  7. EI8IC

    EI8IC Ham Member QRZ Page

    Hello guys: yes I am still working through this problem! I haven't found the answer, but I have found a work-around. Would still like a working answer, though.

    To recap: I am programming in VB.Net, for Windows machines. I am trying to get 2 or more programs on the same computer to receive the same UDP messages sent by the N1MM logger.

    Progress to date: This N1MM page ( says that using a Multicast Address is not an option at the moment.

    The N1MM UDP help page ''
    says: 'A note to software developers: Vasily K3IT has found that if both SO_BROADCAST and SO_REUSEADDR options are used when a UDP port is opened, it is opened in a ‘non-exclusive’ mode. This allows multiple applications to share the same port, as long as they all follow this method. Using these flags helps avoid port conflict issues'.

    Although I can set the option 'UdpListener.ExclusiveAddressUse = False' this just stops Program Exceptions, rather than letting the port be actually shared.

    In N1MM Logger, to enable external UDP broadcasts I select 'Config > Config Ports… > Broadcast Data',
    but the only options there are to choose which type of messages I wish to receive, and to set the IP Address and the Port Number.

    From the example given in (
    it appears that if I want to add multiple computers, or multiple programs in the same computer, then they each need a separate entry with unique IP Address and Port Number, which implies to me that the message-type from the originator of the message is not a 'Broadcast'. I don't know how to check that.

    Adjacent to the 'Type of data > Contacts' entry is a CheckBox: 'All Computers' but apparently this command is useful only in Networked Computer mode, when a number of computers are networked together.

    I did try setting a double entry: '' to send QSOs to two programs on the same IP Address looking at ports 12060 and 12061 but this did not let two programs receive at the same time.

    The notes say 'You can send UDP broadcasts to all the IP addresses in the subnet by specifying 255 for the last section, or “octet”. For example, will send to all computers that are in the 192.168.1 subnet'.
    I therefore tried setting the entry '' to send QSOs to two programs looking at port 12060 but this did not work either, even if the program's IP addresses were different.

    I then tried setting a double entry: '' to send QSOs to two programs with different IP Addresses and Port Numbers and this did work: both programs received the message.
    KA9JLM likes this.
  8. K6CLS

    K6CLS Ham Member QRZ Page

    I'm glad you found success!!
  9. N6YWU

    N6YWU Ham Member QRZ Page

    Are the port numbers configurable? I shouldn't be hard to write a short C program (or using any other your favorite network programming language) to receive UDP packets on one port, and copy and spit them out on multiple other ports. Or to write something similar for a Raspberry Pi to receive UDP on one port, and send the UDP packets on to two or more IP addresses with the same port number. There may even be prewritten packet forwarding code on GitHub.
  10. TJNII

    TJNII QRZ Member

    Any 127.x.x.x address should work the same a as the entire subnet is reserved for loopback ( So if the sender can send to multiple addresses that makes sense that it worked.

    Kind of surprising it won't take but oh well. Glad you found an easy solution.
    EI8IC likes this.

Share This Page