Hi i am starting a personal project and i would like someone to point me in the right direction. Basically what i am tryin to do is to get a computer to telnet to another. So the program would therefore run and then i would enter the ip address and port of the target computer i am trying to connect to, then enter the username and password to logon, and then i can run the telnet commands within it.....e.g - telnet 127.0.0.1 100
I was discussing it with a friend of mine and he was telling me about looking into the use of sockets so thats what i am currently doing. I would like for anyone who is willing to at least let me know if i am going in the right direction or if there is a simpler way to do this besides the socket method. Also any snippets of code are always welcomed.
Thanks in advance for any help.
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
Well as i said its a personal project and im doing it just because....and dont want one that is finished or anything i just want to do one and see if i myself can do as i am still a newbie in programming and then there are other things i plan to do after i finish this step.
Now the following code i got form http://msdn.microsoft.com/en-us/libr...(v=VS.85).aspx and after i ran it in my VS 2010 it compiled without errors but when i ran it the output window flashed and disappeared... can anyone tell me why?
Also i saw that a guy mentioned that
"Annoyingly, this wouldn't compile properly with default Visual C++ 2010 project settings. This is because project default to using Unicode.
Instead of {struct addrinfo ...} you must use {ADDRINFOT ...}$0 $0Instead of getaddrinfo() you must use GetAddrInfo()
I guess this is just old documentation, but an update so it will compile with a default install of VC would greatly assist beginning programmers like myself "
However i dont quite understand what hes gettin at or if its even the solution to my problem but any help would be greatly appreciated. Thanks
Below is the output im gettin now after making a few changes but im not exactly sure what this means. I hope this means that a connection was actually established because then all i would have to do is maybe change the IP address to the address of a computer on the network and then i can begin the telnet process of sending commands. Does anyone have any input?
OUTPUT:
Bytes Sent: 14
Bytes received: 21
Received data =  ²% ¹☺ ¹♥ ²' ²▼ ²Connection closed
Press any key to continue . . .
That's probably the telnet server querying the client for supported options. These are established before the session ever gets to a prompt. See the telnet RFC:
Bookmarks