Deleted Added
full compact
dgramsend.c (34104) dgramsend.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.

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

62 /*
63 * Construct name, with no wildcards, of the socket to send to.
64 * Gethostbyname() returns a structure including the network address
65 * of the specified host. The port number is taken from the command
66 * line.
67 */
68 hp = gethostbyname(argv[1]);
69 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.

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

62 /*
63 * Construct name, with no wildcards, of the socket to send to.
64 * Gethostbyname() returns a structure including the network address
65 * of the specified host. The port number is taken from the command
66 * line.
67 */
68 hp = gethostbyname(argv[1]);
69 if (hp == 0) {
70 fprintf(stderr, "%s: unknown host\n", argv[1]);
70 fprintf(stderr, "%s: unknown host\en", argv[1]);
71 exit(2);
72 }
73 bcopy(hp->h_addr, &name.sin_addr, hp->h_length);
74 name.sin_family = AF_INET;
75 name.sin_port = htons(atoi(argv[2]));
76 /* Send message. */
77 if (sendto(sock, DATA, sizeof(DATA), 0, &name, sizeof(name)) < 0)
78 perror("sending datagram message");
79 close(sock);
80}
71 exit(2);
72 }
73 bcopy(hp->h_addr, &name.sin_addr, hp->h_length);
74 name.sin_family = AF_INET;
75 name.sin_port = htons(atoi(argv[2]));
76 /* Send message. */
77 if (sendto(sock, DATA, sizeof(DATA), 0, &name, sizeof(name)) < 0)
78 perror("sending datagram message");
79 close(sock);
80}