• 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 (2): OTBind + Serial Endpoint
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re (2): OTBind + Serial Endpoint


  • Subject: Re (2): OTBind + Serial Endpoint
  • From: Quinn <email@hidden>
  • Date: Tue, 27 Aug 2002 11:39:12 +0100

At 12:18 +0200 27/8/02, Jiri Volejnik wrote:
But what address buffer size other than 0 should I use, when there is no
address structure specified for Serial Endpoints? I tried several casual
sizes, but with no success.

Serial endpoints don't have an address structure. You should always bind them with an empty address.

This is what I was trying the first time, but it gives the same error.

If that's the case, it must be caused by something other than the actual bind. OTBind(ep, NULL, NULL) is definitely the way to go for serial endpoints. Here's some code I wrote that does exactly this (talking to my phone via its IrDA port).

// If we're debugging, always open a TCP connection.

useTCP = OTStrEqual(portName, "tilisten,tcp");
*portDescPtr = OTOpenEndpointInContext(OTCreateConfiguration(portName), 0, nil, &err, nil);
if (err == noErr) {
junk = OTSetSynchronous(*portDescPtr);
MoreAssertQ(junk == noErr);

junk = OTSetBlocking(*portDescPtr);
MoreAssertQ(junk == noErr);

if (gYieldingNotifierUPP == nil) {
gYieldingNotifierUPP = NewOTNotifyUPP(YieldingNotifier);
MoreAssertQ(gYieldingNotifierUPP != nil);
}

junk = OTInstallNotifier(*portDescPtr, gYieldingNotifierUPP, *portDescPtr);
MoreAssertQ(junk == noErr);

junk = OTUseSyncIdleEvents(*portDescPtr, true);
MoreAssertQ(junk == noErr);
}

if (err == noErr) {
if ( ! useTCP ) {
// Opening a real serial port.
// Don't bother setting serial port options because the IR
// port driver just ignores them anyway.
// There's no address to bind to, so just bind.
err = OTBind(*portDescPtr, nil, nil);
// And there's no address to connect to either, so just connect.
if (err == noErr) {
TCall sndCall;
OTMemzero(&sndCall, sizeof(sndCall));
err = OTConnect(*portDescPtr, &sndCall, nil);
}
} else {
[...]
}
}

Are you sure you've opened a serial port?

S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
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 (2): OTBind + Serial Endpoint (From: Jiri Volejnik <email@hidden>)

  • Prev by Date: Re (2): OTBind + Serial Endpoint
  • Next by Date: Problems setting the Terminal Script for PPP on OS X?
  • Previous by thread: Re (2): OTBind + Serial Endpoint
  • Next by thread: Problems setting the Terminal Script for PPP on OS X?
  • Index(es):
    • Date
    • Thread