Xojo TCPSocket.Close vs TCPSocket.Disconnect

What’s the difference? When should one be used over the other?

very subtle differences
TCPSocket.Close is the inherited method
It shuts everything associated with the socket down - and really leaves it in a state that its not reliable to try & reuse it - in fact you’re at least as well of to NIL any references if you use close.

TCPSocket.Disconnect closes comms but doesnt tear down the internals so you could ask it to Connect and it would likely work

Thanks, Norm.
I’ve been using TCPSocket.Close and getting some “issues” when re-opening, so I’ll try .Disconnect instead, and .Close only when exiting the program and see if that works better.

Yeah close is more total destruction :stuck_out_tongue:
Disconnect is just “close the connection but I might want to reuse it”

1 Like