int main(int argc,char *argv[]){ options_parse(argc,argv); int ret = fd_connect(); if(ret != 0){ fprintf(stderr,"connect refreshd error!"); exit(-1); } call_func func_array[] = { {"test_read_data",test_read_data}, {"test_add_url",test_add_url}, {NULL,NULL} }; int index = 0; for(;func_array[index].desc != NULL;index++){ printf("%d - %s\n",index,func_array[index].desc); } int number; scanf("%d",&number); (func_array[number].func)(); return 0; }
int sock_connect(net_sock_t *nsock, const char *hostname, int port, Net_timeout_t timeout) { network_sock_t *sock = (network_sock_t *)nsock; if (sock == NULL) return(-1); //** If NULL exit return(fd_connect(&(sock->fd), hostname, port, sock->tcpsize, timeout)); }