Re: OpenTransport binding
Re: OpenTransport binding
- Subject: Re: OpenTransport binding
- From: Jens Bauer <email@hidden>
- Date: Sun, 9 Jun 2002 00:14:12 +0200
Hi mike,
It isn't really complicated. If you download the samples from <ftp://
ftp.apple.com/developer/Sample_Code/> you will see that you need to
typecast to an (UInt8 *), so it would look something like this:
reqAddr.addr.buf = (UInt8 *) &thisAddr;
On Fri, 7 Jun, 2002, mike <email@hidden> wrote:
>
Hello,
>
>
I'm going to apologize in advance if this topic is unsuitable for
>
this forum.
>
I just picked up the OpenTransport docs earlier this week and have been
>
trying to do a little network programming using UDP packets to send info
>
back and forth between a Mac and a Solaris Unix machine. I have no
>
problems getting the info from the Mac to the Unix machine, but I am
>
having problems binding an endpoint, which uses a UDP endpoint provider,
>
to the port/address I want to receive packets on with the Mac. I'm
>
writing in C and am having issues with matching up the types of
>
structures that I need to pass the OTBind function. The OTBind function
>
wants a structure of type TBind that includes the address in a TNetBuf,
>
but when I try to set the TNetBuf.buf to an InetAddr containing the IP
>
and port I want to receive on it says it wants an unsigned char pointer
>
and wont accept the InetAddr pointer. I cant figure out how to get the
>
port and address i want into the TBind struct that I need to pass to
>
OTBind, and all the sample code I find is in C++ and the functions take
>
different arguments.
>
>
Here's a snippet of the applicable code i've written:
>
>
TBind reqAddr, retAddr;
>
InetAddress thisAddr; // which i initialize to the port/address
>
i want
>
>
udpIn = OTOpenEndpoint(OTCreateConfiguration("udp"), 0, nil, &err);
>
>
reqAddr.addr.buf = &thisAddr;
>
reqAddr.addr.len = sizeof(thisAddr);
>
reqAddr.addr.maxlen = sizeof(struct InetAddress);
>
>
junk = OTBind(udpIn, &reqAddr, &retAddr);
>
>
I'll be the first to admit that my understanding of all the structures
>
and functions is foggy, so if anyone could provide me with a little info
>
as to what I'm doing wrong that would be much appreciated.
Love,
Jens
--
Jens Bauer, Faster Software.
-Let's make the World better, shall we ?
_______________________________________________
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.