equal
deleted
inserted
replaced
65 if ((sockfd = connection (argv[1], atoi (argv[2]))) < 0) { |
65 if ((sockfd = connection (argv[1], atoi (argv[2]))) < 0) { |
66 printf ("Connection error: %s:%d\n", argv[1], atoi (argv[2])); |
66 printf ("Connection error: %s:%d\n", argv[1], atoi (argv[2])); |
67 return EXIT_FAILURE; |
67 return EXIT_FAILURE; |
68 } |
68 } |
69 |
69 |
70 write (sockfd, "GET /\r\n", 7); |
70 if (write (sockfd, "GET /\r\n", 7) == -1) { |
|
71 perror ("write"); |
|
72 return EXIT_FAILURE; |
|
73 } |
71 |
74 |
72 while ((num = read (sockfd, buffer, 1023)) != 0) { |
75 while ((num = read (sockfd, buffer, 1023)) != 0) { |
73 buffer[num] = 0; |
76 buffer[num] = 0; |
74 printf ("%s", buffer); |
77 printf ("%s", buffer); |
75 } |
78 } |