I think there are many solutions for your problem:
1. As JohnFill says you make a separate thread for the window in witch you have the cCancel Button, and on cancel event you can do this:
* make a SetEvent call to announce tha main thread that cancel was pressed.
* in the Send loop of the main program (of your socket class), you should verify the state of this event. if it is Signaled you should call Abort or cancel in other way the sending of the data (I suppose you make it through packets).
Hope of being of some help, s-)
Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...