ping_discover_network
ping_discover_network copied to clipboard
flush and close the connection
In some occasions on some devices, when you scan the network and after it's done connect to that device on the same port the connection is not closed properly.
My proposal is to add flush and close before destroy:
final Socket s = await Socket.connect(host, port, timeout: timeout); await s.flush(); await s.close(); s.destroy();