x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 
Latest Forum Activity

Building 'telnetd' sample in PB 4.2

cybertheque Page Icon Posted 2013-02-14 8:24 PM
#
Avatar image of cybertheque
H/PC Newbie

Posts:
9
Location:
United States
Status:
Hoping to build a 'telnetd' for PPC 2003 (on iPAQ 2210) using the sample code in Platform Builder 4.2; I did the following:

1. opened a command shell set up for building (view OS Release Dir)

2. ran 'build' in %_WINCEROOT%\PUBLIC\SERVERS\SDK\SAMPLES\TELNETD

3. examined 'build.log' and the created 'obj' subdirectory -- object files were built
and 'telnetd.lib' was created in %_WINCEROOT%\PUBLIC\SERVERS\OAK\LIB\ARMV4I\RETAIL

4. edited 'sources' to change 'TARGETTYPE=LIBRARY' to 'TARGETTYPE=DYNALINK'

5. removed compiled objects and reran 'build' -- no dll (or .lib) file was generated, also no errors.

Here is the only description of the build and install process provided (from the readme):

** Installation and Starting & Stopping this sample Telnet Server **
To build the telnet server on Windows CE 3.0, you must add the word "telnetd" to the
end of the line SERVERS_MODULES in %_WINCEROOT\public\maxall\oak\misc\cesysgen.bat.
After doing this, run "sysgen clean" and then "qbuild" in an appropriate build window.

To build the telnet server on Windows CE 2.12, copy the files sources-212 to sources
and build in an appropriate build window. This will create telnetd.dll in your flat
release directory. At this point add the following lines to your project.reg:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\TELNETD]
"Dll"="TELNETD.Dll"
"Order"=dword:9
"Keep"=dword:1
"Entry"="TelnetDInitialize"

And add the following line to project.bib:
telnetd.dll $(_FLATRELEASEDIR)\telnetd.dll NK SH

The build process is different for Windows CE 2.12 because telnetd is not in its
sysgen step on older versions of the OS.


To disable the telnet server once it running on a system, it is necessary to set the
IsEnabled registry value to 0, as described above. Once telnet has been loaded by
device.exe, it cannot be unloaded. To uninstall telnetd from a system when running in
this configuration, you must delete the registry key
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\TELNETD], warm boot your device, and then delete
telnetd.dll.

=======================================================

Do I need to do a global build or sysgen of some kind to get it? How about a link
command to try?

All help appreciated!

Michael
 Top of the page
cybertheque Page Icon Posted 2013-02-18 4:50 PM
#
Avatar image of cybertheque
H/PC Newbie

Posts:
9
Location:
United States
Status:
There is an implementation of the abovementioned sample telnetd code that I found to work on Pocket PC 2003 (wm2003) at http://www.urian.eu/applications/telnetd/index.htm I am still interested in understanding the process to include the sample telnetd in a system image however (if anyone has done this to completion).

Now, having telnet access into the iPAQs, I am finding that every 'console' application that I run in a telnet session outputs its stdout and stder to a device window and not the telnet session. I will write a simple program that uses both stdin and stdout and compile it under cegcc to see how that works but in the meantime would someone care to enlighten me about implementation details that are it issue in what I am observing here?

Thanks again,

Michael
 Top of the page
cybertheque Page Icon Posted 2013-02-18 10:07 PM
#
Avatar image of cybertheque
H/PC Newbie

Posts:
9
Location:
United States
Status:
Obviously I will need to climb the curve to understand wince 4.2 if I intend to develop in it -- I may just cut the Gordian knot and work on getting a reliable port of *nix running on the iPAQs instead...

Results of experiments running a simple keyboard I/O program in a console:

#include <stdio.h>

int main (int argc, char *argv)
{

char inp[80];
char *inp_p = &inp[0];

while (strncmp(inp_p, "exit") != 0)
{
scanf("%s", inp_p);
printf("line read: %s\n", inp_p);
}
}


1. compiled with gcc mingw32 4.5.3 for x86 and run in a 'cmd.exe' window, the program runs as expected, accepting input from the keyboard and outputing to the screen in the same window

2. compiled with arm-mingw32ce-gcc 4.1.0 and run in a 'cmd.exe' window on the iPAQ, the program opens a new window to handle the i/o, and closes it on exit, returning to the parent window which has no output

3. as in 2. above but run from a telnet session, the program opens a new window on the iPAQ, and does not accept input from the telnet session, but only on the device itself, and behaves otherwise as in 2. above.

-- guess I had naively expected i/o redirection in the manner of pseudo-tty device in the telnet session too.

So, in a nutshell, how does read from the keyboard and write to the existing cmd.exe window in wince 4.2?

Thanks

==========================================

found this on an msdn forum site:

Windows CE .NET 4.2: Running STDIO Applications on Headless Windows CE .NET Platforms
Submitted by: Richard R. Lee, Windows Embedded MVP
A number of handy applications use the "C" library stdio routines for console I/O. Text-based applications written in "C" are easily adapted to Windows CE .NET. Several essential diagnostics provided with Platform Builder—ipconfig and ping come to mind—are essentially unchanged from the Standard "C" legacy source code.Under Windows CE .NET, these applications rely on APIs provided with CMD.EXE to fetch keyboard input and to present text output to the display. On embedded devices where both display hardware and user input devices may be absent, running these applications presents a challenge.

The "Telnet Server" sample component which comes with Windows CE .NET provides a relatively compact STDIO execution environment on platforms with networking support. The component brings in "Core Server Support" and "Command Processor" from the catalog along with the server, adding about 100K to my 1.5MB x86 retail NK.BIN. GWES is not required. This is the same CMD.EXE runtime environment as in the display based case, so all of the file system commands are available, as well as batch support.

I access the Windows CE .NET device from my host development system using the telnet client provided with Windows XP.Permission to connect to the telnet server is restricted to authenticated users by default. This may be disabled, with the registry key:

[HKEY_LOCAL_MACHINE\COMM\TELNETD]
"UseAuthentication"=dword:0

These tips are for informational purposes and are provided only as a convenience. The entire risk of use or results in connection with the use of these tips remains with the user.

--he seems to be saying here that existing command-line programs should work within the stdio environment of the telnet server -- hmmmmmmmm

Edited by cybertheque 2013-02-18 10:24 PM
 Top of the page
Jump to forum:
Seconds to generate: 0.140 - Cached queries : 60 - Executed queries : 9