use single thread rather than multiple thead to avoid lcok for TCP and UDP