Re: [dhcwg] question about basic broadcast

Martin.Stiemerling@ccrle.nec.de Fri, 28 September 2001 11:05 UTC

Received: from optimus.ietf.org (ietf.org [132.151.1.19] (may be forged)) by ietf.org (8.9.1a/8.9.1a) with ESMTP id HAA08919; Fri, 28 Sep 2001 07:05:06 -0400 (EDT)
Received: from optimus.ietf.org (localhost [127.0.0.1]) by optimus.ietf.org (8.9.1a/8.9.1) with ESMTP id HAA29874; Fri, 28 Sep 2001 07:03:48 -0400 (EDT)
Received: from ietf.org (odin [132.151.1.176]) by optimus.ietf.org (8.9.1a/8.9.1) with ESMTP id GAA28628 for <dhcwg@optimus.ietf.org>; Fri, 28 Sep 2001 06:15:00 -0400 (EDT)
Received: from mail.bucknell.edu (marge.bucknell.edu [134.82.9.1]) by ietf.org (8.9.1a/8.9.1a) with ESMTP id GAA08464 for <dhcwg@ietf.org>; Fri, 28 Sep 2001 06:14:53 -0400 (EDT)
From: Martin.Stiemerling@ccrle.nec.de
Received: from yamato.ccrle.nec.de (yamato.ccrle.nec.de [195.37.70.1]) by mail.bucknell.edu (8.11.6/8.11.6) with ESMTP id f8SAEvi11839 for <dhcp-v4@bucknell.edu>; Fri, 28 Sep 2001 06:14:58 -0400 (EDT)
Received: from citadel.mobility.ccrle.nec.de ([192.168.156.1]) by yamato.ccrle.nec.de (8.11.3/8.10.1) with ESMTP id f8SAGIf98276; Fri, 28 Sep 2001 12:16:18 +0200 (CEST)
Received: by citadel.mobility.ccrle.nec.de (Postfix on SuSE eMail Server 2.0, from userid 30) id C8B7BC113; Fri, 28 Sep 2001 12:14:55 +0200 (CEST)
To: Ranganath Sudarshan <tsranga@stanford.edu>
Subject: Re: [dhcwg] question about basic broadcast
Message-ID: <1001672095.3bb44d9fb9f7b@citadel.mobility.ccrle.nec.de>
Date: Fri, 28 Sep 2001 12:14:55 +0200
Cc: dhcp-v4@bucknell.edu
References: <Pine.GSO.4.33.0109271518260.11576-100000@fable5.Stanford.EDU>
In-Reply-To: <Pine.GSO.4.33.0109271518260.11576-100000@fable5.Stanford.EDU>
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
User-Agent: IMP/PHP IMAP webmail program 2.2.3
X-Originating-IP: 192.168.102.180
Content-Transfer-Encoding: 8bit
Sender: dhcwg-admin@ietf.org
Errors-To: dhcwg-admin@ietf.org
X-Mailman-Version: 1.0
Precedence: bulk
List-Id: <dhcwg.ietf.org>
X-BeenThere: dhcwg@ietf.org
Content-Transfer-Encoding: 8bit

Hi Ranganath,

this list is for protocol developement issues, not for programing questions. 
Please try another available lists.

By the way: The below C program will never compile, and if you use the right 
parameter in sendto() you'll have more success.
Here is the definition of sendto:

ssize_t sendto(int s, const void *msg, size_t len, int flags, const struct 
sockaddr *to, socklen_t tolen)

See:
http://www.freebsd.org/cgi/man.cgi?
query=sendto&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html


Zitiere Ranganath Sudarshan <tsranga@Stanford.EDU>:

> Hi,
> I was trying to get the following scenario to work:
> 
> On one machine on the LAN, you have a Java program listening on some
> port
> X for datagram packets coming in.
> 
> On another box, which is running FreeBSD and which does NOT have an IP
> address configured (pre-DHCP configuration), I want to have code which
> broadcasts a message to 255.255.255.255, port X, and I want the other
> box
> running Java to pick up this datagram packet.
> 
> int on = 1;
> char *msg = strdup("message");
> sockfd = socket(AF_INET, SOCK_DGRAM, 0);
> setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
> their_addr.sin_family = AF_INET;
> their_addr.sin_port = htons(MYPORT);
> their_addr.sin_addr.s_addr = inet_addr("255.255.255.255");
> memset(&(their_addr.sin_zero), '\0', 8);
> numbytes = sendto(sockfd, msg, strlen(msg), MSG_DONTROUTE);
> 
> numbytes is returned as -1 and the error: Network is Unreachable is
> returned.
> 
> Does anyone know what the problem may be?  My basic aim is to have the
> FreeBSD box without IP configured be able to communicate with my box
> running a Java Datagram listener.  I would greatly appreciate any help
> on
> this matter.  I realize that the problem is a subset of what DHCP
> enables
> one to do, but I wish to only have this simple functionality, and not
> all
> of the DHCP protocol.
> 
> Thanks,
> RTS
> 
> 
> 
> _______________________________________________
> dhcwg mailing list
> dhcwg@ietf.org
> http://www1.ietf.org/mailman/listinfo/dhcwg
> 
> 



_______________________________________________
dhcwg mailing list
dhcwg@ietf.org
http://www1.ietf.org/mailman/listinfo/dhcwg