0
votes

I am working on a c# project that has a mdi parent form hosting multiple mdi children form. In one of the children forms, I opened a socket and listening on the socket using tcpListner. I stop the tcpListner when user close that mdi childform. But when I close the mdi parent without close the mdi children form first, the tcpListner did not get stopped.

My question is: Do I have to manually call each mdi children's form_close event handler when I close Mdi-parent form? How to make sure a specific socket is closed or tcpListner is stopped?

Thanks

1
There is no obvious correlation between closing a form and stopping a TcpListener. Explain how you stop it.Hans Passant
I just call tcpListner.stop() in form_close event handler.user195678

1 Answers

0
votes

Perhaps you might try putting it into the form_closing event? It fires before the form_close event.