UDP broadcast problem

Michael P. Reilly arcege at golem.usmsas.maine.edu
Fri Mar 15 04:22:36 AEST 1991


Hi folks,

  I'm writing a server network (similar to lpd) for heterogeneous machines,
using TCP/UDP protocols. I'd like to have a client broadcast a query to the LAN
requesting host information from the servers (I'm expecting 2-4 servers on
the LAN). I've tried a few techniques using UDP protocols (which seems the
best way to go) but I can't seem to get back responses from the net (except
from the host the client was running on). I've tried sending out on INADDR_ANY
and the broadcast address from ifconfig (only the INADDR_ANY setting returned
a response, and that was from the server at that host). The broadcast addresses
I tried were 130.111.128.255, 130.111.255.255, 130.111.128.0, 130.111.0.0,
where 130.111 is my net address. Also ioctl(fd, SIOCGBRDADDR, &ifreq_struct)
returns with error ENXIO, where

    { int fd, val, len = sizeof(val);
      fd = socket(AF_INET, SOCK_DGRAM, 0);
      getsockopt(fd, SOL_SOCKET, SO_BROADCAST, &val, &len);
      val = ~val;
      setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &val, len);
      getsockopt(fd, SOL_SOCKET, SO_BROADCAST, &val, &len);
    }

was applied. After first getsockopt, val was equal to zero, and after the
second, val had the value of 32. I assume the broadcast value would be any
non-zero value.

  Any help out there??

Machines: DS3100, AT&T 3b15 (and possible SUN 3/60 and NeXT).
Operating Systems: Ultrix 4.0, System V R3.1.1 with TCPWIN (and sockets).
Network: Ethernet based, TCP/IP.
    All the tests so far have been on the 3100's.

Thanks all!
              Michael Reilly

+=======================================+=====================================+
|Michael Reilly				| Inter:   arcege at cs.usmsas.maine.edu |
|Unix Systems Admin/Analyst		| BITNet:  arcege at portland.bitnet     |
|Computer Science Dept.			|         ip60401 at portland.bitnet     |
|University of Southern Maine		| UUCP: (links temporarily down)      |
|96 Falmouth Street, Portland, ME 04103	| BellNet: (207) 780-4515	      |
+---------------------------------------+-------------------------------------+



More information about the Comp.unix.wizards mailing list