Deleted Added
full compact
streamwrite.c (34105) streamwrite.c (34211)
1.\" Copyright (c) 1986, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 51 unchanged lines hidden (view full) ---

60 if (sock < 0) {
61 perror("opening stream socket");
62 exit(1);
63 }
64 /* Connect socket using name specified by command line. */
65 server.sin_family = AF_INET;
66 hp = gethostbyname(argv[1]);
67 if (hp == 0) {
1.\" Copyright (c) 1986, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 51 unchanged lines hidden (view full) ---

60 if (sock < 0) {
61 perror("opening stream socket");
62 exit(1);
63 }
64 /* Connect socket using name specified by command line. */
65 server.sin_family = AF_INET;
66 hp = gethostbyname(argv[1]);
67 if (hp == 0) {
68 fprintf(stderr, "%s: unknown host\n", argv[1]);
68 fprintf(stderr, "%s: unknown host\en", argv[1]);
69 exit(2);
70 }
71 bcopy(hp->h_addr, &server.sin_addr, hp->h_length);
72 server.sin_port = htons(atoi(argv[2]));
73
74 if (connect(sock, &server, sizeof(server)) < 0) {
75 perror("connecting stream socket");
76 exit(1);
77 }
78 if (write(sock, DATA, sizeof(DATA)) < 0)
79 perror("writing on stream socket");
80 close(sock);
81}
69 exit(2);
70 }
71 bcopy(hp->h_addr, &server.sin_addr, hp->h_length);
72 server.sin_port = htons(atoi(argv[2]));
73
74 if (connect(sock, &server, sizeof(server)) < 0) {
75 perror("connecting stream socket");
76 exit(1);
77 }
78 if (write(sock, DATA, sizeof(DATA)) < 0)
79 perror("writing on stream socket");
80 close(sock);
81}