[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

usage of NotifyRouteChange

shiv ag

10/7/2003 11:49:00 PM

hi,
I need to use this "NotifyRouteChange" API to listen for
routing table update asynchronously. The APi definition
says

DWORD NotifyRouteChange(
PHANDLE Handle,
LPOVERLAPPED overlapped
);

Does someone have nay sample code for this ?? How to
define the PHANDLE and LPOVERLAPPED parameters. Please
help !!

thanks.
3 Answers

(Mattias Sjögren)

10/8/2003 2:13:00 PM

0

>Does someone have nay sample code for this ?? How to
>define the PHANDLE and LPOVERLAPPED parameters. Please
>help !!

It depends on how you intend to call the function. If you're going to
pass information to both parameters, you should declare it like this

[DllImport("iphlpapi.dll")]
static extern uint NotifyRouteChange(out IntPtr Handle, ref OVERLAPPED
overlapped);

But if you plan to pass NULL to them then this declaration is better

[DllImport("iphlpapi.dll")]
static extern uint NotifyRouteChange(IntPtr Handle, IntPtr
overlapped);



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.n...
Please reply only to the newsgroup.

shiv ag

10/8/2003 6:15:00 PM

0



hi Mattias,
Thanks for your reply. I know whatever you have said. My question is
that how t oasynchronously receive a notification when the routing table
changes. So I call this API and it returns. then what ? how is my code
informed of the change ? I want this to happen in a non blocking way and
asynchronously. Is there any way to register a call back function that
will be called whenenver the routing table changes. A sample code of the
functionality would help.

thanks
S.


*** Sent via Developersdex http://www.develop... ***
Don't just participate in USENET...get rewarded for it!

(Mattias Sjögren)

10/17/2003 11:36:00 PM

0


>My question is
>that how t oasynchronously receive a notification when the routing table
>changes. So I call this API and it returns. then what ? how is my code
>informed of the change ?

Follow the links from the NotifyRouteChange docs page to the topics
about "Synchronization and Overlapped Input and Output" and "I/O
Completion Ports".


>I want this to happen in a non blocking way and
>asynchronously. Is there any way to register a call back function that
>will be called whenenver the routing table changes.

Well there's the BindIoCompletionCallback API, but I'm not sure it's a
good idea to call that from managed code.

I would probably just poll using HasOverlappedIoCompleted.



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.n...
Please reply only to the newsgroup.