TELNETD.C
资源名称:ertos.rar [点击查看]
上传用户:sunrenlu
上传日期:2022-06-13
资源大小:1419k
文件大小:1k
源码类别:
操作系统开发
开发平台:
DOS
- #include <net.h>
- #include <rtos.h>
- #include <stdio.h>
- #include <mem.h>
- #include <telnetd.h>
- void dummythread( DWORD dummy )
- {
- teld_str *t;
- BYTE ch;
- do {
- t = teld_listen( 23 );
- teld_write( t, "connectedrn", 11 );
- do {
- ch = teld_getc( t );
- if ( ch == 255 ) break;
- if ( ch != 0 ) putch( ch );
- if ( kbhit() ) {
- ch = getch();
- /* break on ESC */
- if ( ch == 27 ) exit( 0 );
- teld_write( t, &ch, 1 );
- }
- } while ( 1 );
- teld_close( t );
- } while ( 1 );
- }
- main()
- {
- kdebug = 1;
- rt_init(100);
- sock_init(); /* initialize network */
- cputs("starting... press ESC to exitrn");
- rt_newthread( dummythread, 0, 4096, 0, "worker" );
- do {
- /* nothing */
- rt_yield();
- } while ( 1 );
- }