networking - Seamless Handover in Windows CE 5.0 and higher using WLAN and VPN over GPRS -
i have little tricky problem using network under windows ce .net compact framework.
i try describe...
first of there 3 types of connections established while starting application.
first 1 wlan connection company network
second 1 gprs connection
third 1 openvpn connection should use gprs underlying.
default way user in wlan area , connects company network. times user has leave wlan area needs network connection, connection should seamless switch grps on openvpn. if user enters wlan area again, connection should seamless switch wlan.
so have tried observe connections notified if wifi goes down , switch gprs.
now problem can't find way decide wich network adapter used if open socket tcp-connection in application.
is there way?
update:
now i've tried this:
foreach (networkinterface inf in networkinterface.getallnetworkinterfaces()) { if (inf.name == "cellular line") { try { ipaddress addr = inf.currentipaddress; socket sock = new socket(addressfamily.internetwork, sockettype.stream, protocoltype.tcp); ipendpoint ep = new ipendpoint(addr, 10); sock.bind(ep); ipendpoint remotetcpserver = new ipendpoint(3025045080, 8000); sock.connect(remotetcpserver); break; } catch (exception ex) { messagebox.show(ex.message); } } }
if there 1 adapter powered on work. if enable wlan , gprs connection fails...
what's wrong this?
if you're using windows mobile there simpler way go using optimal connection: use connection manager. connect via wi-fi first priority if available. connection manager should choose in order: wi-fi -> vpn -> gprs based on availability of connections. can specify adapter use if want full control on connection choice. connection manager notify when connection status changes.
if you're using windows ce connection manager isn't available , things more difficult. can bind socket specific adapter want use. can use ip helper api enumerate adapters.
Comments
Post a Comment