Bind cowcli to low port

This commit is contained in:
Neale Pickett 2012-01-19 22:13:44 -07:00
parent 15a5fc93c7
commit 9aa18abe20
1 changed files with 8 additions and 0 deletions

View File

@ -11,6 +11,8 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <fcntl.h> #include <fcntl.h>
#define DEBUG
int int
bind_port(int fd, const struct in6_addr *addr, uint16_t port) bind_port(int fd, const struct in6_addr *addr, uint16_t port)
{ {
@ -107,6 +109,12 @@ main(int argc, char *argv[])
* Set up socket * Set up socket
*/ */
sock = socket(AF_INET6, SOCK_DGRAM, 0); sock = socket(AF_INET6, SOCK_DGRAM, 0);
if (-1 == bind_port(sock, &in6addr_any, 44)) {
perror("Binding UDP port 44");
#ifndef DEBUG
return EX_IOERR;
#endif
}
while (1) { while (1) {
char line[20]; char line[20];