[net.unix-wizards] Raw sockets

ji@garfield.columbia.edu (John Ioannidis) (01/30/86)

Has anybody used raw internet-domain (AF_INET, SOCK_RAW) sockets in 4.2bsd? 
Specifically, in what ways do they differ from SOCK_DGRAM sockets?
(Apart from the fact that you have to be root to use them!)
Do you have a sample program/program fragment using them?

Please respond by mail -- I'll summarize if there is enough interest.
Thanks in advance,


#include <appropriate_disclaimers>

VOICE: 	+1 212 280 5510			ARPA: ioannidis@cs.columbia.EDU
USnail:	John Ioannidis			      ji@garfield.columbia.EDU
	450 Computer Science
	Columbia University,		USENET: ...{seismo|topaz}!
	New York, NY 10027			   columbia!garfield!ji

			... It's all Greek to me!

rodger@dcl-cs.ac.uk (08/04/86)

ohhhhhhhh, here goes!!!!!

I've got a minor problem with the concept of networks, sockets,
(and probably UNIX and C).......!!!!!

Can anyone out there in netland offer any advice, code, hints, photographs,
etc on how one gets broadcasting to work with sockets.

I just want to broadcast a datagram out onto the Ethernet but (hankies out)
so far no joy... 
	So far I've tried to use UDP sockets, RAW sockets, the NIT interface
on the SUN 3 (and even shouting into a transceiver) all to no avail.

I'd insert lots of my 'C' code here but you can get your laughs elsewhere !!
suffice to say a lot of it looks like the examples in the manuals (VAX & SUN)
so if any of you bright sparks (and dull sparks) would like to email me
anything (including any unwanted PhD theses) please feel free to do so.

Thanks/merci/danke/dank u wel/umba-unga

		Rodge
-- 
UUCP:	...!mcvax!ukc!dcl-cs!rodger       | Post: University of Lancaster,
DARPA:	rodger%lancs.comp@ucl.cs	  |	  Department of Computing,
JANET:	rodger@uk.ac.lancs.comp		  |	  Bailrigg, Lancaster, UK.
Phone:	+44 524 65201 Ext. 4146		  |	  LA1 4YR
Project: Cosmos Distributed Operating Systems Research (ish)

atkins@nbires.UUCP (Brian Atkins) (08/07/86)

In article <337@comp.lancs.ac.uk>, rodger@dcl-cs.ac.uk writes:
> Can anyone out there in netland offer any advice, code, hints, photographs,
> etc on how one gets broadcasting to work with sockets.

The best place to find examples of broadcasting network
code is in the 4.2 rwhod code.

A large portion of this code (the configure() function, to be exact)
determines what interfaces are available and if they support
hardware broadcast or not.  Once all the "neighbors" (network
and point-point interfaces) have been collected, broadcasting
is done by sending to each neighbor.  Neighbor addresses
are either broadcast (if the HW supports it) or the
destination address of a point to point connection.

Brian Atkins   ...{attunix, hao, allegra, ucbvax}!nbires!atkins
NBI Inc., P.O. Box 9001, Boulder CO 80301	(303) 444-5710

chris@umcp-cs.UUCP (Chris Torek) (08/08/86)

>In article <337@comp.lancs.ac.uk> rodger@dcl-cs.ac.uk writes:
>>Can anyone out there in netland offer any advice, code, hints, photographs,
>>etc on how one gets broadcasting to work with sockets.

In article <499@opus.nbires.UUCP> atkins@nbires.UUCP (Brian Atkins) replies:
>The best place to find examples of broadcasting network
>code is in the 4.2 rwhod code.

Indeed, rwhod and routed are likely the *only* places to find
working examples.  However, anyone looking there should be aware
that the code in both will not work terribly well on a 4.3 system.
The issue of determining broadcast addresses was largely unresolved
in 4.2, and rwhod and routed simply use something that `happened
to work'.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@mimsy.umd.edu