udp connection fails when wifi is disconnected
4 次查看(过去 30 天)
显示 更早的评论
I am trying to create a udp connection to the local host, if I am connected to wifi, it is successful but if I disconnect from the wifi, I get the errror below. How is the wifi connection affecting this?
>> u = matlabshared.network.internal.UDP( ...
'RemoteHost','127.0.0.1', ...
'RemotePort',14550, ...
'LocalPort',14570, ...
'EnablePortSharing',true);
>> u.connect
Cannot create a communication link with the remote server. Please check the input arguments(ADDRESS and PORT) and make sure
the server is running.
Additional Information: resolve: Host not found (authoritative) [asio.netdb:1]
3 个评论
Ishaan
2025-2-21
编辑:Ishaan
2025-2-21
Hey,
I noticed you are using a function that I couldn't find in the official MATLAB documentation. However, there's a function called "udpport" that provides similar functionality for UDP connections. I have tried it on my Windows machine, and it works well, even when I'm not connected to Wi-Fi.
Here is an example showcasing how you can use it.
>> u = udpport("datagram", "LocalPort", 14570, "EnablePortSharing", true);
>> write(u, data, "uint8", "127.0.0.1", 14550);
>> dataReceived = read(u, numBytes, "uint8");
For more information on "udpport", please refer to the following documentation link:
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 .NET Client Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!