networking - QT & UDP-Socket -


I have the QT & amp; Network socket If I have a computer with several IP-addresses in different networks, then how do I open a UDP socket for a multicast group on a specific network adapter / IP address?

Example: IP: 19 2.168.2.1 and 172.20.0.1 and I want to create a socket that receives packets from multicast group 228.5.6.7 on the network adapter 172.20.0.1.

You should determine that imr_interface as shown below: (Maybe it's set to INADDR_ANY )

  struct ip_mreq mreq; Mreq.imr_multiaddr.s_addr = inet_addr ("228.5.6.7"); Mreq.imr_interface.s_addr = inet_addr ("172.20.0.1"); // & lt; ---- OK ... QSocketDevice * sdev = New QSocketDevice (QSocketDevice :: Datagram); ... Setcon (SDV-> Socket), IPPRTIOIIP, IP_ADD_MMARSHIP, (CONST FOUR *) and MREX, Psychof (Strip IPMerake)); ...  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -