Re: Canceling a asynchronous request ???
Re: Canceling a asynchronous request ???
- Subject: Re: Canceling a asynchronous request ???
- From: Rich Kubota <email@hidden>
- Date: Thu, 13 Feb 2003 12:17:04 -0800
At 7:58 PM +0000 2/13/03, Mark Thomas wrote:
Hi,
I think you missed you the
OTSetAsynchronous(endPoint)
call, as the code execution doesn't hold at the OTRcvUData, this is why I
think the OTCancelSynchronousCalls wont work, or will it ???.
(The idea is the notifier will pick up message via T_DATA calls and not
interrupt execution unless it needs to, and then after a fixed period of
time I want to shutdown this listener)
Mark,
I saw this call which led me to see that the endpoint is in async
state. IF you no longer want the notifier to be called, you can make
the OTInstallNotifier call and pass in NULL for the call back routine
and the refPtr from the cancelProc. When your code returns to the
task level processing, you can unbind the endpoint, etc.
rich
Thanks
Mark.
Hi Mark,
In the programming example which you provided, it looks like the
endpoint is being used in a sync blocking manner. When the UDP
endpoint has been bound, has a notifier installed and is set to async
mode, then the process would wait for an incoming data notification
before making the OTRcvUData call. As such, it's not clear why the
cancelProc is needed (except if the endpoint were to be in sync
blocking mode and in that case the OTCancelSyncCalls would be the
right call to make.)
At 2:36 PM +0000 2/13/03, Mark Thomas wrote:
Hi,
Does anyone know how you would stop an endpoint listening, as I
have setup
an UDP listener asynchronously
OTInstallNotifier(endPoint,
NewOTNotifyUPP((OTNotifyProcPtr)notifyProc), &gMessage );
OTSetAsynchronous(endPoint);
OTScheduleTimerTask (
OTCreateTimerTaskInContext(NewOTProcessUPP(cancelProc), endPoint, NULL) ,
5000 );
err = OTRcvUData(endPoint, &udata, NULL );
And I have a timer which will :-
pascal void cancelProc(EndpointRef pEndPoint)
{
// OTCancelSynchronousCalls( pEndPoint, -1234 );
int err = OTCloseProvider( pEndPoint );
gWait = 0;
}
The only way I can see, to stop this end, is to completely shut it down,
via OTCloseProvider, as OTCancelSynchronousCalls isn't going to work, as it
searches the synchronous requests only ???.
I also guess that doing an OTCloseProvider within a notifier
is bad news,
as it could effect memory ???.
Any ideas, how I can stop when the timer executes ???.
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.
--
Sincerely,
Rich Kubota
email@hidden
(408) 974-6212
_______________________________________________
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.