Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Telnet Program

Status
Not open for further replies.

saranam

Programmer
Jan 10, 2003
6
IN
As my accademic project i am trying to implement a
telnet server.
I am having some difficulties in that.If u don't mind,
i expect
some help from you.

At the server side , in seperste sockets i handles
each client.
And as per the req from the client , i have to execute
a program
in the server machine and have to accept its input
from the
client keyboard and display its out put at the client
screen.
What i am thinking is in i will use seperate threads
to handle each
client and one socket for each client,and one socket
to acept conection
on port 23.No the prob is how i can redirect the
client I/O streams
to the process(created for executing the required
program)I/O stream.


At the client side i am planning for a window ,in wich
there is
a portion for console and few buttons.How i can fix
the console
(created using alloc console) at a specified location
in a window.
Can i do it using MFC or should i go for Win 32
programming.
And have to read from the console and have to put
that data to the
out stream of socket and using the data from the
socket i have to display it in
the console.
 
Look up the CreateProcess or CreateProcessAsUser function on the MSDN CD or MS site. Pay special attention to the structure:

STARTUPINFO

Described in the documentation as follows:

The STARTUPINFO structure is used with the CreateProcess, CreateProcessAsUser, and CreateProcessWithLogonW functions to specify the window station, desktop, standard handles, and appearance of the main window for the new process.


typedef struct _STARTUPINFO {
DWORD cb;
LPTSTR lpReserved;
LPTSTR lpDesktop;
LPTSTR lpTitle;
DWORD dwX;
DWORD dwY;
DWORD dwXSize;
DWORD dwYSize;
DWORD dwXCountChars;
DWORD dwYCountChars;
DWORD dwFillAttribute;
DWORD dwFlags;
WORD wShowWindow;
WORD cbReserved2;
LPBYTE lpReserved2;
HANDLE hStdInput;
HANDLE hStdOutput;
HANDLE hStdError;
} STARTUPINFO, *LPSTARTUPINFO;

The last three handles allow you to specify stdin, stdout and stderr for the process.

Good luck,
DJ

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top