• 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: Which OT Sample To Use?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Which OT Sample To Use?


  • Subject: Re: Which OT Sample To Use?
  • From: Quinn <email@hidden>
  • Date: Tue, 4 Feb 2003 08:05:21 +0000

At 12:11 -0500 28/1/03, David F. Johnson wrote:
I need to do the following on pre-OS X (i.e., Mac OS 9.x) via TCP/IP:

1) Listen for connection attempts to a background-only application
(BOA), with a "unique" port number (and unique message header) for
discerning that it's "for me," and

2) When such a "call" is received, the BOA sub-launches a GUI
application which takes over the back-and-forth communication as well as the
termination of the call.

Basically, the BOA part is the telephone and the GUI part is the hand-set,
so to speak (no pun intended). FWIW, I already have the BOA and GUI done; I
just needs some help on the network connection.

There are two aspects that you need to think about.

1. Accepting the connection -- The key difference between OTVS and OTSimpleServerHTTP is that OTVS runs entirely from its notifier. This is great for performance, but it makes it a pain to code because everything is a state machine. OTVS is not appropriate for your case because, even if you accept the connection in your notifier, your response is to launch an application, which can only be done at system task time. Thus, I'd recommend you go with the OTSimpleServerHTTP approach, at least to start with.

Your third option is, of course, OTMP, but that is probably not acceptable because of its weird system requirements (broken on Mac OS 9.1, for example) and it does complicate the endpoint transfer.

<http://developer.apple.com/samplecode/Sample_Code/Networking/OTMP.htm>

2. Transferring the endpoint -- The BOA should create a listener endpoint and then OTListen and OTAccept. The result of this is a new worker endpoint that you want to transfer to the launched application. You should do this transfer using OTTransferProviderOwnership. This is reasonably well documented in "IM:NWOT".

If you don't transfer the endpoint correctly, you'll get into a situation where quitting the BOA will cause the app to crash.

There's a sample that shows how to call OTTransferProviderOwnership.

<http://developer.apple.com/samplecode/Sample_Code/Networking/TransferProvider.htm>

Unfortunately, the sample got messed up when one of our interns converted it from an old version of CW to a more modern version. It's been on my list of things to fix, but that list is kinda long )-: The source code is still correct, it's just that the way the code is built doesn't actually demonstrate the point of the sample. If you end up using this technique, drop me a line and I'll send you the original version of the sample that is built correctly.

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.

  • Prev by Date: Re: Browser resource usage
  • Next by Date: MIME types and wildcards...
  • Previous by thread: Re: Browser resource usage
  • Next by thread: Re: Which OT Sample To Use?
  • Index(es):
    • Date
    • Thread