Switching between networks

  • Thread starter Thread starter Andy Baker
  • Start date Start date
A

Andy Baker

I have a VB.NET 2003 application running on a CE 4.2 device, that connects
wirelessly to an SQL Server 2000 database running on a PC network. The
device also connects via the internal 802.11b card to a wireless portable
printer. I have both of these parts of the application running OK, but my
problem is that I have to manually switch between the 2 connections. I need
my application to do this automatically. Can anyone tell me how to do this?
I also have a problem with IP addresses. Currently, when connected to the
network, the CE device receives an automatic IP address, but with the
printer I have to set up a static IP address. Can this be set up from the
application, or am I better off using one static IP address for both parts.
If this is the case do I need to set up the network to use the same set of
IP addresses as the printer(s)?Thanks in advance.

Andy Baker
 
There are two network *adapters*? Or you're using the same network adapter
both for printer and for SQL Server? If you have just a single adapter, you
don't want to be swapping its IP address all over the place. Have the
printer assigned an IP on the same network as the SQL Server (consult the
network admin or whatever). Then you can access each host easily with no
network switching around.

Paul T.
 
Hi Paul

Thanks for the reply. I have just one network adapter in my CE device. The
printer is not attached to the network, it is a vehicle mounted portable
printer, that will be used solely with the CE device in ad-hoc mode. I have
set up 2 networks on the device, one for the printer, and one for the PC
network. I have set a static IP address for the device, in the 192.168
range - the same range as the printer and the network, so I no longer have
to change IP addresses, but as far as I can see, the CE device can only
connect to one 'network' at a time. When printing, I need to connect to the
printer, and when transferring data, I need connect to the SQL Server
network, and I need my application to switch between them without any user
intervention. My question is, how can I achieve this within my .NET program?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
 
Hi Andy,
did you try something like routing the IP packets? On PC you could change
the route for a specific IP address with route.exe. Route.exe is also
available for WinCE. You could give the routes a higher or lower METRIC, so
you can decide, where the IP-packets will be send.
If route.exe is not available on your device, you could do some tries with
the OpenNETCF.Net classes. They PInvoke the iphlpapi.dll, which is also used
by route.exe.
Steffen N.
 
Unfortunately, that won't work in this case. You have a single network
adapter, there's only one route for any packet.

Paul T.
 
Yes, I just think that this is a bad structure. If you assign the printer a
static IP, then you can be continuously attached to the main network *and*
to the printer. That is, I'm telling you that this 'switching networks'
thing is a bad way to do it. It's possible, using the OpenNETCF Smart
Device Framework network stuff, but, again, not a good design choice. It's
complicated, continuously broken in one or the other of the network
connections, etc.

Paul T.

Andy Baker said:
Hi Paul

Thanks for the reply. I have just one network adapter in my CE device. The
printer is not attached to the network, it is a vehicle mounted portable
printer, that will be used solely with the CE device in ad-hoc mode. I
have
set up 2 networks on the device, one for the printer, and one for the PC
network. I have set a static IP address for the device, in the 192.168
range - the same range as the printer and the network, so I no longer have
to change IP addresses, but as far as I can see, the CE device can only
connect to one 'network' at a time. When printing, I need to connect to
the
printer, and when transferring data, I need connect to the SQL Server
network, and I need my application to switch between them without any user
intervention. My question is, how can I achieve this within my .NET
program?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
There are two network *adapters*? Or you're using the same network
adapter both for printer and for SQL Server? If you have just a single
adapter, you don't want to be swapping its IP address all over the place.
Have the printer assigned an IP on the same network as the SQL Server
(consult the network admin or whatever). Then you can access each host
easily with no network switching around.

Paul T.
 
Thanks for getting back to me again. The printer will be mounted in a
vehicle, and has a static IP address that enables it to communicate in
ad-hoc mode to the CE device. I cannot always be attached to the main
network, as it won't always be in range, but I only need to be at the start
and end of the day. The rest of the time I need to be attached to the
printer. Do you mean I set up the printer in infrastructure mode, with a
static IP address, so that it is part of the network.? Will this work if I
am not in range of the wireless access point? If the 'switching networks' is
a bad
way to do it, what is a good way? I apologise if I am not understanding
correctly what you are saying, but I am fairly new to this.

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
Yes, I just think that this is a bad structure. If you assign the printer
a static IP, then you can be continuously attached to the main network
*and* to the printer. That is, I'm telling you that this 'switching
networks' thing is a bad way to do it. It's possible, using the OpenNETCF
Smart Device Framework network stuff, but, again, not a good design
choice. It's complicated, continuously broken in one or the other of the
network connections, etc.

Paul T.

Andy Baker said:
Hi Paul

Thanks for the reply. I have just one network adapter in my CE device.
The
printer is not attached to the network, it is a vehicle mounted portable
printer, that will be used solely with the CE device in ad-hoc mode. I
have
set up 2 networks on the device, one for the printer, and one for the PC
network. I have set a static IP address for the device, in the 192.168
range - the same range as the printer and the network, so I no longer
have
to change IP addresses, but as far as I can see, the CE device can only
connect to one 'network' at a time. When printing, I need to connect to
the
printer, and when transferring data, I need connect to the SQL Server
network, and I need my application to switch between them without any
user
intervention. My question is, how can I achieve this within my .NET
program?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:[email protected]...
There are two network *adapters*? Or you're using the same network
adapter both for printer and for SQL Server? If you have just a single
adapter, you don't want to be swapping its IP address all over the
place. Have the printer assigned an IP on the same network as the SQL
Server (consult the network admin or whatever). Then you can access
each host easily with no network switching around.

Paul T.

I have a VB.NET 2003 application running on a CE 4.2 device, that
connects wirelessly to an SQL Server 2000 database running on a PC
network. The device also connects via the internal 802.11b card to a
wireless portable printer. I have both of these parts of the application
running OK, but my problem is that I have to manually switch between the
2 connections. I need my application to do this automatically. Can
anyone tell me how to do this? I also have a problem with IP addresses.
Currently, when connected to the network, the CE device receives an
automatic IP address, but with the printer I have to set up a static IP
address. Can this be set up from the application, or am I better off
using one static IP address for both parts. If this is the case do I
need to set up the network to use the same set of IP addresses as the
printer(s)?Thanks in advance.

Andy Baker
 
OK. The ranging issue limits your choices. You'll have to do what I
described lightly before, using some RF library to control the settings.
When you switch to printer mode, you'll have to disassociate from the
infrastructure mode network and connect to the ad hoc network. While you're
disconnected, presumably you'll set a static IP that's compatible with the
IP/subnet of the printer. Then, when it's time to connect to the
infrastructure network, you'll have to undo that and return to the
configuration that matches that network. I've never done this and the
library wasn't constructed with much emphasis on ad hoc, but I think that
OpenNETCF SDF should be able to do what you need to do.

Paul T.

Andy Baker said:
Thanks for getting back to me again. The printer will be mounted in a
vehicle, and has a static IP address that enables it to communicate in
ad-hoc mode to the CE device. I cannot always be attached to the main
network, as it won't always be in range, but I only need to be at the
start
and end of the day. The rest of the time I need to be attached to the
printer. Do you mean I set up the printer in infrastructure mode, with a
static IP address, so that it is part of the network.? Will this work if I
am not in range of the wireless access point? If the 'switching networks'
is a bad
way to do it, what is a good way? I apologise if I am not understanding
correctly what you are saying, but I am fairly new to this.

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
Yes, I just think that this is a bad structure. If you assign the
printer a static IP, then you can be continuously attached to the main
network *and* to the printer. That is, I'm telling you that this
'switching networks' thing is a bad way to do it. It's possible, using
the OpenNETCF Smart Device Framework network stuff, but, again, not a
good design choice. It's complicated, continuously broken in one or the
other of the network connections, etc.

Paul T.

Andy Baker said:
Hi Paul

Thanks for the reply. I have just one network adapter in my CE device.
The
printer is not attached to the network, it is a vehicle mounted portable
printer, that will be used solely with the CE device in ad-hoc mode. I
have
set up 2 networks on the device, one for the printer, and one for the PC
network. I have set a static IP address for the device, in the 192.168
range - the same range as the printer and the network, so I no longer
have
to change IP addresses, but as far as I can see, the CE device can only
connect to one 'network' at a time. When printing, I need to connect to
the
printer, and when transferring data, I need connect to the SQL Server
network, and I need my application to switch between them without any
user
intervention. My question is, how can I achieve this within my .NET
program?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message There are two network *adapters*? Or you're using the same network
adapter both for printer and for SQL Server? If you have just a single
adapter, you don't want to be swapping its IP address all over the
place. Have the printer assigned an IP on the same network as the SQL
Server (consult the network admin or whatever). Then you can access
each host easily with no network switching around.

Paul T.

I have a VB.NET 2003 application running on a CE 4.2 device, that
connects wirelessly to an SQL Server 2000 database running on a PC
network. The device also connects via the internal 802.11b card to a
wireless portable printer. I have both of these parts of the
application running OK, but my problem is that I have to manually
switch between the 2 connections. I need my application to do this
automatically. Can anyone tell me how to do this? I also have a problem
with IP addresses. Currently, when connected to the network, the CE
device receives an automatic IP address, but with the printer I have to
set up a static IP address. Can this be set up from the application, or
am I better off using one static IP address for both parts. If this is
the case do I need to set up the network to use the same set of IP
addresses as the printer(s)?Thanks in advance.

Andy Baker
 
Hi Paul

Gotive, the manufacturers of the CE device that I am using, have written a
library that allows me to do what I want to do. I can connect and disconnect
from the Windows network without a problem, unfortunately there is a bug in
the library that means it doesn't connect to ad-hoc devices correctly - but
they are working on it. Thanks for your advice.

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
OK. The ranging issue limits your choices. You'll have to do what I
described lightly before, using some RF library to control the settings.
When you switch to printer mode, you'll have to disassociate from the
infrastructure mode network and connect to the ad hoc network. While
you're disconnected, presumably you'll set a static IP that's compatible
with the IP/subnet of the printer. Then, when it's time to connect to the
infrastructure network, you'll have to undo that and return to the
configuration that matches that network. I've never done this and the
library wasn't constructed with much emphasis on ad hoc, but I think that
OpenNETCF SDF should be able to do what you need to do.

Paul T.

Andy Baker said:
Thanks for getting back to me again. The printer will be mounted in a
vehicle, and has a static IP address that enables it to communicate in
ad-hoc mode to the CE device. I cannot always be attached to the main
network, as it won't always be in range, but I only need to be at the
start
and end of the day. The rest of the time I need to be attached to the
printer. Do you mean I set up the printer in infrastructure mode, with a
static IP address, so that it is part of the network.? Will this work if
I
am not in range of the wireless access point? If the 'switching networks'
is a bad
way to do it, what is a good way? I apologise if I am not understanding
correctly what you are saying, but I am fairly new to this.

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:[email protected]...
Yes, I just think that this is a bad structure. If you assign the
printer a static IP, then you can be continuously attached to the main
network *and* to the printer. That is, I'm telling you that this
'switching networks' thing is a bad way to do it. It's possible, using
the OpenNETCF Smart Device Framework network stuff, but, again, not a
good design choice. It's complicated, continuously broken in one or the
other of the network connections, etc.

Paul T.

Hi Paul

Thanks for the reply. I have just one network adapter in my CE device.
The
printer is not attached to the network, it is a vehicle mounted
portable
printer, that will be used solely with the CE device in ad-hoc mode. I
have
set up 2 networks on the device, one for the printer, and one for the
PC
network. I have set a static IP address for the device, in the 192.168
range - the same range as the printer and the network, so I no longer
have
to change IP addresses, but as far as I can see, the CE device can only
connect to one 'network' at a time. When printing, I need to connect to
the
printer, and when transferring data, I need connect to the SQL Server
network, and I need my application to switch between them without any
user
intervention. My question is, how can I achieve this within my .NET
program?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message There are two network *adapters*? Or you're using the same network
adapter both for printer and for SQL Server? If you have just a
single adapter, you don't want to be swapping its IP address all over
the place. Have the printer assigned an IP on the same network as the
SQL Server (consult the network admin or whatever). Then you can
access each host easily with no network switching around.

Paul T.

I have a VB.NET 2003 application running on a CE 4.2 device, that
connects wirelessly to an SQL Server 2000 database running on a PC
network. The device also connects via the internal 802.11b card to a
wireless portable printer. I have both of these parts of the
application running OK, but my problem is that I have to manually
switch between the 2 connections. I need my application to do this
automatically. Can anyone tell me how to do this? I also have a
problem with IP addresses. Currently, when connected to the network,
the CE device receives an automatic IP address, but with the printer I
have to set up a static IP address. Can this be set up from the
application, or am I better off using one static IP address for both
parts. If this is the case do I need to set up the network to use the
same set of IP addresses as the printer(s)?Thanks in advance.

Andy Baker
 
Back
Top