The question "is it good" can be understood in different aspects.
"Can something bad happen to an OS or to a communicating application on the other side if I kill some process?"
No. Your application should be able to handle it safely, because such disruptions can always happen in real life. But it depends on how you write it.
"Is it an acceptable programming practice?"
Absolutely not. If you use killing of some process to go out of some difficult situation, consider your project totally failed.
I cannot tell you how you can "fix" your code, because it is probably wrong by design. Please see my past answers; in particular, I described the problem of disconnection:
How Do I Get To Know If A A Tcp Connection Is Over[
^],
an amateur question in socket programming[
^],
Multple clients from same port Number[
^].
—SA