Good day,
I recently bought a new Sony Camera that allows remote functionality over a wireless connection. All is good so far and it works with Sony's official app on my android phone. I now want to create a C# Winforms app that can also connect to the device and manipulate some features.
The device first requires a discovery request with SSDP M-SEARCH. Can someone maybe point me to a C# Winforms example where SSDP M-Search device discovery is used. So far I'm using UdpClient and the supplied IP and Port to connect from Sony's manual. Code so far:
static string SSDP_ADDR = "239.255.255.250";
static string SSDP_ST = "urn:schemas-sony-com:service:ScalarWebAPI:1";
UdpClient ucs = new UdpClient(1900);
string data = "M-SEARCH * HTTP/1.1\r\n" +
"HOST: 239.255.255.250:1900\r\n" +
"ST:" + SSDP_ST + "\r\n" +
"MAN:\"ssdp:discover\"\r\n" +
"MX:3\r\n\r\n";
Byte[] sendBytes = Encoding.ASCII.GetBytes(data);
ucs.Connect("239.255.255.250", 1900);
ucs.Send(sendBytes, sendBytes.Length);
ucs.Close();
IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 1900);
UdpClient ucr = new UdpClient(1900);
Byte[] receiveBytes = ucr.Receive(ref RemoteIpEndPoint);
listBoxInfo.Items.Add(Encoding.ASCII.GetString(receiveBytes));
Thank you.