Nc won't send udp broadcast!?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Nc won't send udp broadcast!?
# 1  
Old 11-27-2012
Nc won't send udp broadcast!?

Greetings,

I want to send broadcast udp from a script.

This works but is not broadcast:
Code:
echo -n "this is my message\r\n" | nc -u 192.168.0.12 5100

The broadcast version does not work:
Code:
echo -n "this is my message\r\n" | nc -u 192.168.0.255 5100

Suggestions on the right way to do this are welcome!

Thanks in advance,
Steve.
# 2  
Old 11-27-2012
looking for the word 'broadcast' in the manual page for nc finds this:

Code:
       -b           allow UDP broadcasts

# 3  
Old 11-28-2012
Interestingly enough, the -b option is only listed in the man page for some versions, but not others, of nc. I'm running both ubuntu and archlinux and have a different version on each (both are openBSD netcat though). I've tried -b on both and neither works. In the case where it's not listed in the man page, I get the expected "usage:..." response. In the one where it is listed in the man page I get "nc: Protocol not available". Both cases have been run from root...

I have not tried either the "traditional" netcat or the GNU netcat yet. I would be nice if someone out there actually knew if it worked and on what...

Or if someone could suggest a better way to do it...

---------- Post updated at 09:01 PM ---------- Previous update was at 04:42 PM ----------

never got nc to work and found many messages on the web regarding others who also couldn't get it to work. However, the following (from itsaunixsystem.com/unix/?p=5) does work as expected:
Code:
echo -n "message\r\n" | socat - udp-datagram:192.168.0.255:5100,broadcast


Last edited by anotherstevest; 11-27-2012 at 08:14 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash script won't run because hardware won't produce display

Can anyone offer any advice on how to modify the script below to work on a new system we have, that has no graphics capability? We admin the system through a serial RAS device. I've tried running the below script through the RAS and through an ssh -X session. It failed with something like "GTK... (3 Replies)
Discussion started by: yelirt5
3 Replies

2. Programming

how to do udp broadcast with multithreading

hello to all i want to use multithreading to my UDP broadcast server client program. will anyone help me by proving C code. i am working in fedora. also my requirement is POSIX compliance.please help me..... (6 Replies)
Discussion started by: moti12
6 Replies

3. IP Networking

how to do udp broadcast with multithreading

hello to all i want to use multithreading to my UDP broadcast server client program. will anyone help me by proving C code. i am working in fedora. also my requirement is POSIX compliance.please help me..... (0 Replies)
Discussion started by: moti12
0 Replies

4. Red Hat

[help] how to send wall/broadcast message to all clients

Hi, as per title, please help me.. I use command wall host1 host2 hellowwwww but it only receive in the host1.. how can I send this to all the clients.. I want this 1 server to send to all the clients.. or is there any program that I can use? I know this openfire, but seems complicated since... (5 Replies)
Discussion started by: flekzout
5 Replies

5. UNIX for Advanced & Expert Users

Why UDP broadcast don't run?

I use FreeBSD7.0, I want to use UDP broadcast,my code is following: /*udpcli01.c*/ int main(int argc, char **argv) { int sockfd; struct sockaddr_in servaddr; if (argc != 2) err_quit("usage: udpcli <IPaddress>"); bzero(&servaddr, sizeof(servaddr)); servaddr.sin_family = AF_INET;... (2 Replies)
Discussion started by: konvalo
2 Replies

6. AIX

won't mount /usr...won't boot fully

Hello: NOOB here. I attempted to use smit mkcd. Failed on first attempt, not enough space. 2nd attempt tried to place iso on /usr, not enough space there. Cleanup ran for about 5 minutes after aborting. Now AIX won't boot. LCD display on 7029-6E3 says: 0517 MOUNT /USR. Attempted to boot from CD... (11 Replies)
Discussion started by: bbird
11 Replies

7. Shell Programming and Scripting

Script to send something via UDP and intercept at other end?

I am looking to do a shell script that can send something simple via UDP from server 1 - to server 2 I want to be able to see on server 2 that I received everything expected.. ie.. I am looking at this to avoid using ping / traceroute to highlight network issues.. if a UDP packet gets lost... (1 Reply)
Discussion started by: frustrated1
1 Replies

8. Programming

UDP socket - can both client and server recv and send

Hi, Am very new to socket programming. When we use UDP sockets to communicate between two processess, will both the client/server socket be able to send/recv ? meaning can sendto()/ recvfrom() be used on both server and client? It could be useful even if anybody provide some link on socket... (1 Reply)
Discussion started by: rvan
1 Replies

9. UNIX for Dummies Questions & Answers

What is my UDP send/recieve buffer size

Hi, If some one was to suggest, "increase your kernal tunables related to UDP, in particular the UDP send/recieve buffer size".... then what would they mean? :confused: How can I find out what this current value is? Thousand many thanks. Neil (3 Replies)
Discussion started by: nhatch
3 Replies

10. UNIX Desktop Questions & Answers

broadcast

Can anybody hellp me troubleshoot this error. Using HP-Uxix B.10.X " *****ARPA/9000 NETWORKING***** Mon Jun 30 SAT 2003 20:18:12.xxxxxxx DISASTER Subsys: NS_LS_PROBE LOC:01001 Network NS_LS_PROBE DISASTER 1001, pid arp: ether address is broadcast for IP address zzzzzzz! " where... (1 Reply)
Discussion started by: SEB
1 Replies
Login or Register to Ask a Question