summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2009-01-22 11:17:53 (GMT)
committer Jaromil <jaromil@dyne.org>2009-01-22 11:17:53 (GMT)
commit76b8394b1905f2661c561d4d037c56f6fe490d7c (patch)
treef4f32491e5925ba3d13a203264e716ae8e07c734
parent986b98f9041e70cb2b2706a82a222cf2976fba77 (diff)
configurable port in udpbroadcast
and some cleanup
-rw-r--r--.gitignore8
-rwxr-xr-xcompile.sh3
-rw-r--r--udpbroadcast.cpp9
3 files changed, 15 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..953a20c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+*.o
+ivysync-gtk
+ivysync-nox
+ivysync-rpc
+ivysync-udp
+udpbroadcast
+xmlrpc++/libxmlrpc++.a
+
diff --git a/compile.sh b/compile.sh
index cce8ad0..003b94c 100755
--- a/compile.sh
+++ b/compile.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
echo
echo
@@ -21,6 +21,7 @@ echo
echo "press a number and then [enter]"
read -s sel
+make clean
case $sel in
1)
diff --git a/udpbroadcast.cpp b/udpbroadcast.cpp
index 742d46b..7e9ae73 100644
--- a/udpbroadcast.cpp
+++ b/udpbroadcast.cpp
@@ -25,8 +25,9 @@ int main(int argc, char *argv[])
int broadcast = 1;
//char broadcast = '1'; // if that doesn't work, try this
- if (argc != 3) {
- fprintf(stderr,"usage: broadcaster hostname message\n");
+ if (argc != 4) {
+ fprintf(stderr,"usage: broadcaster hostname port message\n");
+ fprintf(stderr,"hostname can be 255.255.255.255 for broadcast\n");
exit(1);
}
@@ -48,11 +49,11 @@ int main(int argc, char *argv[])
}
their_addr.sin_family = AF_INET; // host byte order
- their_addr.sin_port = htons(SERVERPORT); // short, network byte order
+ their_addr.sin_port = htons( atoi(argv[2]) ); // short, network byte order
their_addr.sin_addr = *((struct in_addr *)he->h_addr);
memset(their_addr.sin_zero, '\0', sizeof their_addr.sin_zero);
- if ((numbytes=sendto(sockfd, argv[2], strlen(argv[2]), 0,
+ if ((numbytes=sendto(sockfd, argv[3], strlen(argv[3]), 0,
(struct sockaddr *)&their_addr, sizeof their_addr)) == -1) {
perror("sendto");
exit(1);