Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3956

UDPSocket.Close not working when NetworkInterface is set

$
0
0

On MacOS, calling UDPSocket.Close() after using the socket with UDPSocket.NetworkInterface set to a non-nil value, fails to reset the socket.

Subsequent attempts to Connect() will give an Error 65

The Documentation for UDPSocket says:

Close
Closes the socket’s connection, closes any connections the socket may have, and resets the socket.
The only information that is retained after calling Close is the socket’s port, address (in the case of TCPSockets), and data left in the socket’s receive buffer. All other information is discarded.

Workaround - manually setting NetworkInterface to nil before calling close seems to work.

// workaround for bug https://tracker.xojo.com/xojoinc/xojo/-/issues/78685
dim u as UDPSocket = UDPSocket1
if u.NetworkInterface <> nil then
  system.DebugLog "UDPSocket.Setting NetworkInterface to nil"
  u.NetworkInterface = nil
end if

system.DebugLog "UDPSocket.Close()"
u.close

Reported as https://tracker.xojo.com/xojoinc/xojo/-/issues/78685

4 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 3956

Trending Articles