Re: UDP and OT
Re: UDP and OT
- Subject: Re: UDP and OT
- From: <email@hidden>
- Date: Thu, 12 Dec 2002 12:08:34 +0000
- Organization: Coderus Ltd
Hi,
>
>
This is wrong. If you want to broadcast, you need to use the address
>
255.255.255.255, not kOTAnyInetAddress, which translates to 0.
>
Better yet, get the subnet broadcast address from
>
OTInetGetInterfaceInfo.
>
Sounds like a good idea, will use {InetInterfaceInfo}.fBroadcastAddr then.
>
> udata.addr.len = sizeof(dest_addr);
>
> udata.addr.maxlen = sizeof(dest_addr);
>
> udata.addr.buf = (unsigned char *) &dest_addr;
>
>
>
> udata.opt.len = 0;
>
> udata.opt.maxlen = 0;
>
> udata.opt.buf = nil;
>
>
>
> // Does it copy the data ???
>
> udata.udata.len = 30;
>
> udata.udata.maxlen = 30;
>
> udata.udata.buf = (UInt8 *) NewPtr (30);
>
>
Yes.
>
>
btw This is covered in the OT documentation. In summary, for async
>
requests, any input parameters are copied before the call returns,
>
but any output parameters must survive until the corresponding
>
request completion notifier.
>
Must have missed that as I have read through that 886 page document. Async
makes sense, so sync I presume no copying.
>
>
Huh? On OT you always have to bind before sending or receiving.
>
Perhaps you're confusing OT with sockets, where binding is optional
>
for outgoing connections.
>
Yepps, my previous unix socket experience.
>
However, you should bind the client using OTBind(ep, NULL, NULL).
>
You don't need the client to be bound to a specific port.
>
ok.
>
You should also use the IP_BROADCAST option on the client and
>
probably the IP_REUSEADDR option on the server. See IM:NWOT for
>
details.
>
Why would you set IP_BROADCAST on a client, documented say to have
permission on sending them, so I thought Server ???.
I was planning on using IP_DONTROUTE as well, so my packets don't get
sent out. Although most routers don't send on UDP packets regardless of this
setting.
>
Finally, I recommend you stay away from broadcasting on a subnet. If
>
you want to do service discovery, use multicasts. Better yet, use
>
Rendezvous.
Would love to use Rendezvous, but I need to be 9.x as well. I am only
using this initially to find what Servers are initially available, to get
their IP address and initial info, once that's done use a connection method.
Although, I am aware that broadcasting on a subset you cannot relay on
delivery. Its should be the most efficient on the amount of traffic on the
network, as it would be in effect one packet making the rounds, which is
sent out and each machine will just notice its there. This relies on only
one machine sending these, not all of them. Is this not true ???.
Thanks
Mark.
_______________________________________________
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.