#include #include #include #include #include #include #include #include #include #include #define BUFFER_SIZE 30000 #define ATTEMPTS 100 char buf[BUFFER_SIZE]; /* argv[1] - nazwa hosta argv[2] - numer portu */ int main(int argc, char **argv) { struct sockaddr_in endpoint; int sdsocket, addrlen, i, received; struct hostent *he; struct timeval time_b, time_e; if (argc<3) { printf("podaj nazwe hosta i numer portu jako parametry (provide hostname and port number in command line)\n"); return 1; } he = gethostbyname(argv[1]); if (he == NULL) { printf("Nieznany host (unknown kost): %s\n",argv[1]); return 0; } endpoint.sin_family = AF_INET; endpoint.sin_port = htons(atoi(argv[2])); endpoint.sin_addr = *(struct in_addr*) he->h_addr; addrlen = sizeof(struct sockaddr_in); gettimeofday(&time_b, NULL); for (i=0; i