I'm writing a program that connects to a server and sends some data. This happens in a thread, which is started by a Form, which in turn has a Cancel button. I would like the connection (attempt) to be cancelled when the user presses Cancel.
So I've tried several things:Setting the worker thread to null, closing the connection, setting the connection to null, closing the input stream or output stream (all are members of the Form, the thread is an inner class of the Form). This works ok in the MMAPI emulator (which I have to use because I'm also using MMAPI functions), but at the second connection (after having cancelled one before) the phone just hangs so badly, I can't even close the Midelt anymore and have to turn it off. I'm testing with a Nokia 3650.
Which is the recommended way to abort a connection?