Posts tagged ‘Hosts’

Mobile development: pocketHosts-Edit Windows Mobile hosts entries

PocketPC and Windows Mobile does not support a hosts file as desktop windows. As I recently had to add an entry for a virtual machine running Mini SAP (Netweaver 7.01 Trial) I stumbled about how to add a host entry to a windows mobile device.

pocketHosts

The platform builder help gives the details about how host entries are organized:

Host Name

The host name can be configured through the HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts subkey. When an application calls gethostbyname or getaddrinfo, the registry is queried first, before a DNS or WINS request is sent. If the host name is found in the registry, the registry values are returned.

The following table shows the values for the HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts\<Host Name> subkey.

Value : type Description
Aliases : REG_MULTI_SZ This value stores the aliases by which this host is known.
ExpireTime : REG_BINARY If the current time, obtained by calling GetCurrentFT, exceeds the value in ExpireTime, the entire Host Name subkey is deleted the next time that gethostbyname is called. The length of this value is 8 bytes.
ipaddr : REG_BINARY This value stores the IPv4 addresses associated with this host name. The length of this value is 4 bytes per address.
ipaddr6 : REG_BINARY This value stores the IPv6 addresses associated with this host name. The length of this value is 20 bytes per address (16 bytes for address and 4 bytes for Scope ID).

So, there is no simple hosts file.

Continue reading ‘Mobile development: pocketHosts-Edit Windows Mobile hosts entries’ »

Mobile Development-PingAlert: watch your servers

Are you looking for a tool that periodically pings a list of hosts? Here is a toolset that will reschedule a ping utilitiy. This ping utility pings a list of hosts and will create notifications if one or most hosts failed to answer.

I have done this toolset with three separate applications. The scheduler and the notification tool are written in C/C++ win32 API cause this API provided the best access to all the possibilities of the used functions. The user notification API is only supported with basic functionality by CF2. The CEUserNotification API is not supported by CF2 at all.

Although OpenNetCF provides an C# interface to the used APIs, I did not like to include all the unneeded stuff. On the other hand the scheduler is fast and small written in C/C++. With C# I had problems with the notification, especially for removing existing notifications and why should the main tool reside in memory just for showing the notification.

The ping tool is written in C# targeting Compact Framework 2. C# was the easiest to implement the GUI.

All source is available thru one Visual Studio 2008 solution. Yes, you can mix C/C++ and CF2 within one solution.

Continue reading ‘Mobile Development-PingAlert: watch your servers’ »