minor improvement for tcp client, macro for task registration