search method
void
search(
[ - String? searchTarget
])
Implementation
void search([String? searchTarget]) {
searchTarget ??= 'upnp:rootdevice';
final buff = StringBuffer();
buff.write('M-SEARCH * HTTP/1.1\r\n');
buff.write('HOST: 239.255.255.250:1900\r\n');
buff.write('MAN: "ssdp:discover"\r\n');
buff.write('MX: 1\r\n');
buff.write('ST: $searchTarget\r\n');
buff.write('USER-AGENT: unix/5.1 UPnP/1.1 crash/1.0\r\n\r\n');
final data = utf8.encode(buff.toString());
for (var socket in _sockets) {
if (socket.address.type == _v4Multicast.type) {
socket.send(data, _v4Multicast, 1900);
}
if (socket.address.type == _v6Multicast.type) {
socket.send(data, _v6Multicast, 1900);
}
}
}