• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using the broadcast address
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using the broadcast address


  • Subject: Re: Using the broadcast address
  • From: "Marc Epard" <email@hidden>
  • Date: Thu, 16 May 2002 11:39:06 -0500

You can get the broadcast address from the InetInterfaceInfo for the
interface you want to broadcast on.

InetInterfaceInfo interfaceInfo;

ZERO(interfaceInfo);
error = OTInetGetInterfaceInfo(&interfaceInfo, kDefaultInetInterface);
(error handling removed)

if (interfaceInfo.fBroadcastAddr != 0)
broadcastAddress = interfaceInfo.fBroadcastAddr;
else
broadcastAddress = interfaceInfo.fAddress | ~interfaceInfo.fNetmask;


Also, be sure to negotiate the IP_BROADCAST option for the endpoint.

struct TOption : public TOptionHeader
{
UInt32 value;
};

TOption optionBuffer;

optionBuffer.len = sizeof(optionBuffer);
optionBuffer.level = INET_IP;
optionBuffer.name = IP_BROADCAST;
optionBuffer.status = 0;
optionBuffer.value = T_YES;

TOptMgmt optReq;
optReq.flags = T_NEGOTIATE;
optReq.opt.maxlen = sizeof(optionBuffer);
optReq.opt.len = sizeof(optionBuffer);
optReq.opt.buf = (UInt8*) &optionBuffer;

VERIFYNOERR(endpoint->OptionManagement(&optReq, &optReq));
ASSERT(optionBuffer.status == T_SUCCESS);

-Marc

Marc Epard
Netopia, Inc.
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Using the broadcast address (From: Joel Bender <email@hidden>)

  • Prev by Date: Rendevous/Zeroconfig with Carbon CFM
  • Next by Date: Re: Rendevous/Zeroconfig with Carbon CFM
  • Previous by thread: Re: Using the broadcast address
  • Next by thread: Re: Using the broadcast address
  • Index(es):
    • Date
    • Thread