2

I have created a UDP socket via process A. However my process A does not have root access to set socket options using the setsockopt api from linux to bind it with the broadcast IP (255.255.255.255).

So I have created another process B with root rights to do this job. I am passing the socket handle to the new process B and trying to set the socket options like below :

setsockopt(iSocket_UDP_Client_bcast, SOL_SOCKET, SO_BINDTODEVICE, pszDeviceName, sizeof(strlen(pszDeviceName)))

However, I am not successful in setting the socket options even though process B has root rights.

Can anyone help me with this or suggest any other way to get this done?

P.S : I cannot give root rights to my main process A.

Thanks in advance

Arjun Sanu
  • 21
  • 2
  • One thing you can try: use `socat` to received broacast messages and send them to a socket you're listen to: `socat UDP4-RECVFROM:6666,broadcast UDP4:127.0.0.6666` – Mathieu Jan 14 '20 at 15:14

0 Answers0