enable send pkt function, hanndle window close event