Put send logic in thread, added --cmd argument