eleminate race condition of accessing hostinfo in thread:
1. move indexing logic to main
2. create type parm_t holding connfd and the index
3. pass the parms to threads