Hi guys
Today I tried to write e very simple c# script just to see if I could contact my yeelight bulb, but I cannot recieve answer, maybe I didn’t quite get how c# multicasting should be done, can you help ?
Thanks
IPAddress multicastaddress = IPAddress.Parse("239.255.255.250");
UdpClient udpclient = new UdpClient();
udpclient.JoinMulticastGroup(multicastaddress);
IPEndPoint remoteep = new IPEndPoint(multicastaddress, 1982);
string ssdpMessage = "M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1982\r\nMAN: \"ssdp:discover\"\r\nST: wifi_bulb";
Console.WriteLine(ssdpMessage);
byte[] buffer = Encoding.ASCII.GetBytes(ssdpMessage);
udpclient.Send(buffer, buffer.Length, remoteep);
IPEndPoint AnyEndPoint = new IPEndPoint(IPAddress.Any, 0);
while (true)
{
Byte[] data = udpclient.Receive(ref AnyEndPoint);
string strData = Encoding.ASCII.GetString(data);
Console.WriteLine(strData);
}