iOS16使用单播

This commit is contained in:
祝发冬
2023-08-31 23:34:35 +08:00
parent f38f9effaa
commit b6b5f90962
2 changed files with 10 additions and 3 deletions
+8 -1
View File
@@ -103,8 +103,15 @@
for (int j = 0; j < length; j++) {
[mData appendBytes:&value length:1];
}
NSString*host = kAirKiss_Host;
if (@available(iOS 16.0, *))
{
NSArray *arr = [_localIP componentsSeparatedByString:@"."];
host=[NSString stringWithFormat:@"%@.%@.%@.255",arr[0], arr[1], arr[2]];
}
[_clientUdpSocket sendData:mData
toHost:kAirKiss_Host
toHost:host
port:kAirKiss_Port
withTimeout:-1
tag:_tag];