Broadcasting on a socket

Carl Alex Friis Nielsen cnielsen at imada.dk
Wed Apr 17 11:00:00 AEST 1991


I am currently trying to familiarize myself with the socket-mechanism in
SunOS 4.1.1.  I have written small programs wich send and receive
datagrams via sockets, wich work fine; but now I want to broadcast.  I
have tried to do this by modifying a program wich sends a packet to a
given socket on a given host.  First I create a datagram-socket, wich I
allow to broadcast with setsocopt.  Then I build  an address with family:=
AF_INET, s_addr:= INADDR_BROADCAST and the port I want to send to.  Finaly
I try to broadcast a packet.

I have another program running, which just listens at a known socket;
which works fine when a packet is send to it explicitly.  When i try the
broadcasting program nothing appears to be happening.

I would appreciate it a lot if someone would tell me how to do it/what I
am doing wrong. A simple programming example would be werry helpfull.

  Thanks in advance.

  Carl Alex Friis Nielsen
  EMAIL: cnielsen at imada.dk



More information about the Comp.sys.sun mailing list