Re: LAN and GPRS
From: Scott Herriman (sch_at_callwave.com)
Date: 04/29/04
- Next message: Louis Solomon [SteelBytes]: "Re: No EnumPageFiles in psapi.dll on Win2000"
- Previous message: Sami Korhonen: "Maximum number of pending overlapped calls"
- In reply to: Eugene Gershnik: "Re: LAN and GPRS"
- Next in thread: Eugene Gershnik: "Re: LAN and GPRS"
- Reply: Eugene Gershnik: "Re: LAN and GPRS"
- Reply: oaix: "Re: LAN and GPRS"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 28 Apr 2004 20:07:34 -0700
I second the notion of using IP Helpers. It is difficult to know what the
order of precedence of your connections is. In my recent findings it
appears to work like a push down stack. Starting a VPN after a RAS
connection after a LAN (comes up at boot) is different then RAS after a VPN
after a LAN. To solve this problem IP Helpers will do one thing. You can
get an event when the routing table changes, look at NotifyRouteChange &
NotifyAddrChange. This will let you know when these tables change. You
should be able to compare a previous snapshot with a new snapshot to decide
what action to take.
Yes you can bind to a specific port for TCP. Enumerate all the interfaces
on the machine (gethostbyname or GetIfTable) and bind to each of the
interfaces (or the one that you prefer). When you send data you just need
to indicate which interface is the preferred interface.
I would abstract away all these details from the service itself. You could
have a low level socket interface that does the following:
* Determines which interfaces are available. GetIfTable
* Notices when the list of interfaces changes and updates NotifyRouteChange
NotifyAddrChange
* Binds to the proper interface(s)
* Sends on the preferred interface.
Of course using TCP the stream will be broken when an interface goes down
and you will not want to change sending sockets until the connection is no
longer needed. Sounds to me like you need a socket pool. You check out a
socket and use it until done.
Scott
"Eugene Gershnik" <gershnik@hotmail.com> wrote in message
news:%23VU9OFOLEHA.620@TK2MSFTNGP10.phx.gbl...
> oaix wrote:
> > Thanks.
> >
> > all i need to do is set up a TCP/IP connection with my app server.
> > if LAN is avaiable, i will use LAN, when LAN is unavauable, i'll
> > connect via GPRS.
> >
> > the problem is , once the GPRS is connected, it override the LAN
> > setting . so when i plug in the LAN cable, i have to play with the
> > routing table and make it works but all is by manually, how it could
> > be done by script?
>
> For a programmatic way check IP Helper documentation in MSDN. If you want
to
> expose this functionality to scripts you will have to wrap IP Helper
> functions in a script-friendly COM wrapper.
>
> > my question is the routing table is the only way to slove it?
>
> The correct way is to go through routing table. It captures user desires
> regarding how a connection to a specific destination should be made.
>
> > we
> > can't make it at socket level, right? as i know you can 't bind to a
> > select IP for a TCP/IP client.
>
> Well for UDP there is SO_DONTROUTE but MSDN says that Windows doesn't
honor
> it.
>
> --
> Eugene
>
>
>
- Next message: Louis Solomon [SteelBytes]: "Re: No EnumPageFiles in psapi.dll on Win2000"
- Previous message: Sami Korhonen: "Maximum number of pending overlapped calls"
- In reply to: Eugene Gershnik: "Re: LAN and GPRS"
- Next in thread: Eugene Gershnik: "Re: LAN and GPRS"
- Reply: Eugene Gershnik: "Re: LAN and GPRS"
- Reply: oaix: "Re: LAN and GPRS"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|