struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 500;
tv.tv_usec = 500000;
int retval;
int maxsock=-1;