Caching return address for remote AppleEvents
Caching return address for remote AppleEvents
- Subject: Caching return address for remote AppleEvents
- From: Brian Kelly <email@hidden>
- Date: Fri, 18 Jun 2004 14:45:30 -0700
Hi,
I have a situation where my application can get an AppleEvent from a
remote computer and I want to be able to cache the return address so
that I can send messages to the requesting application at some
indeterminate point later.
This is not a one message - one reply situation; some messages are
requests to monitor an external proprietary network for changes. Such
events do not require a reply AppleEvent but may generate messages
from my server app to the requesting app at any time.
On receiving an AppleEvent I can extract the address of the sender as
typeApplicationURL, but using this value to send a message later
fails to reach the other application.
I'm using this code to get the return address:-
theErr = ::AEGetAttributePtr(&inAppleEvent, keyAddressAttr,
typeApplicationURL, &retType, mURL, sizeof(mURL), &mURLSize);
This returns noErr, and the application URL is something like
"eppc://192.168.123.156:49124/". This is the same value as displayed
in Terminal when using AEDebugReceives. The last five digit part
seems to increment with each message sent from the remote machine.
I'm constructing the event I want to send like this:-
OSErr anErr = AECreateDesc (typeApplicationURL, mURL,
mURLSize, &targetAppDesc);
if ( noErr == anErr )
{
anErr = AECreateAppleEvent( 'Elon', 'Fred',
&targetAppDesc, kAutoGenerateReturnID, kAnyTransactionID,
&appleEvent);
if (noErr = anErr)
{
AppleEvent theReply = {typeNull,nil};
AESendMode sendMode;
anErr = AESend( &appleEvent, &theReply,
kAENoReply, kAENormalPriority, kNoTimeOut, nil, nil );
}
}
Everything returns noErr, but the client application on the remote
machine never sees the message. It does bring up an authentication
dialog on the server machine, but the the message therein is
"Authorization is required to for '' on 'eppc://192.168.123.156."
Which implies that it knows which machine to address, but not which
application.
Am I doing something horribly wrong, or is there some other way I can
extract enough address data from the original request to be able to
cache the address for later use?
Cheers,
Brian
_______________________________________________
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.