Written a Telnet Server

zhaozj2021-02-16  53

O ^ o Telnet Server Source Code Friday 2004 05 28 am 10:16:16

Last night, I was online, and I was more energetic. I remembered the idea of ​​writing a Telnet Server. The result was 2 hours last night, plus 2 hours this morning, a Telnet Server I called o ^ o was born.

The reason I want to write it because I want to implement Telnet Server with a complete OO method, and it is very simple to use OO. And o ^ o Telnet Server means that OO is object-oriented, but it has added "^" in the middle.

O ^ O can support multiple clients simultaneously, call cmd.exe to implement the shell, temporarily only support 2000, XP, 2003 series, because I don't have 98 under VS.NET, so I don't plan to let him support 98.

Just finished, BUG, ​​no matter what he, first come to 0.1 Release to say.

Oh, it's not good to be out of print, don't look at it first!

document list:

App.ico

AskEMBLYINFO.CS

bin

Mainclass.cs

MytelnetServer.csproj

MytelnetServer.csproj.user

MytelnetServer.sln

Telnetcmd.cs

TelnetReader.cs

TelnetSession.cs

TelnetWriter.cs

Description.txt

Part of code:

Public Class TelnetSession

{

Public TelnetSession (TCPCLIENT Client)

{

NetWorkstream Stream = Client.getStream ();

Telnetcmd cmd = new telnetcmd ();

New TelnetReader (stream, cmd);

New TelNetWriter (Stream, CMD);

}

}

Public Class TelnetCMD

{

PROCESS Process1;

StreamReader Reader1;

Streamwriter Writer1;

StreamReader readERR1;

Public StreamReader ReadStream

{

get

{

Return Reader1;

}

}

Public streamwriter Writerstream

{

get

{

Return Writer1;

}

}

Public StreamReader ReaderRSTream

{

get

{

Return READERR1;

}

}

Public telnetcmd ()

{

PROCESS process1 = new process ();

Process1.startinfo.useshellexecute = false;

Process1.startinfo.redirectstandardInput = true;

Process1.startinfo.redirectstandardOutput = true;

Process1.startinfo.redirectstandarderror = True;

Process1.startinfo.filename = "cmd.exe";

PROCESS1.START ();

Reader1 = process1.standardoutput;

Writer1 = process1.standardinput;

Readererr1 = process1.standarderror;

}

}

转载请注明原文地址:https://www.9cbs.com/read-20635.html

New Post(0)