March 28, 2024, 03:54:18 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Telnet Client

Started by mlbaker4, February 24, 2008, 09:08:49 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mlbaker4

I want to write a telnet client that can log into a unix box then by menu send preprogrammed text to automate common functions. I am new at writing code and started in Basic and was discourage by the author that it would be dificult. So I have started in Aurora, I have a window, with menus and have been able by looking at examples, I have made it open a filen close a file, print and close the program. But I am lost with the IP statements, and then how to get a text string to go out the IP port.

Is there any sample code or can someone give me some advice, Does Socket wrench work with this? and do I need to spend &100 dollars. I have been told I should just break down and buy Borland but the price is steep, and I have found other than the DOC's this is a nice language.

Hope some one can lend some advice

Mike

Ionic Wind Support Team

Aurora is in beta, if you feel more confortable with BASIC then by all means use Emergence BASIC, the docs are more complete.

Paul.
Ionic Wind Support Team

mlbaker4

I would rather us Aurora but not sure if I need socketwrench or someother client, and I am not exactly sure where to go next.

Rock Ridge Farm (Larry)

There is a free library 'psftp lib' that could be converted to a dll.
I wanted to do this for some time - just not high on my round -2-it list.
If you do it I would like a copy :)

Mike Stefanik

Quote from: mlbaker4 on February 25, 2008, 01:29:13 AM
I would rather us Aurora but not sure if I need socketwrench or someother client, and I am not exactly sure where to go next.

I emailed you the last build of the Aurora class libraries that were done for SocketTools, so hopefully that can help get you pointed in the right direction. If you decide to go with EBasic, I have a set of declarations and constants for it as well somewhere around here.
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

Rock Ridge Farm (Larry)


Mike Stefanik

They require the SocketTools 5.0 Library Edition (or Secure Library Edition), which isn't free.
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

mlbaker4

I will pay for either if I can get them to compile, otherwise it looks like several huundred dollars for powerbasic, or 800 for Borland, then the cost of the library which isn' bad when you look at the work that was involved.

  Here is what I get Compiling Resources
Compiling...
Timer.src
Connect.src
LoadString.src
Telnet.src
MainWnd.src
Clipboard.src
cstools5.inc
csrtkey5.inc
cserror5.inc
Telnet.inc

Linking...
Aurora Linker v1.0 Copyright ÂÃ,©2005,2006 Ionic Wind Software
Unresolved external CTelnet@CTelnet
Error: Unresolved extern CTelnet@CTelnet
Error: Unresolved extern CTelnet@_CTelnet
Error: Unresolved extern CTelnet@OnConnect
Error: Unresolved extern CTelnet@OnDisconnect
Error: Unresolved extern CTelnet@OnRead
Error: Unresolved extern CTelnet@OnWrite
Error(s) in linking Terminal.exe

Mike Stefanik

Make sure that you're also telling the linker to bring in cstacls5.lib (look for it in the Classes folder, where the source, include and makefiles are). I suspect that it's not finding that library, and that's causing your problem.

Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

mlbaker4

It is showing as included but I still get the same errors in linking any ideas?

LarryMc

Quote from: mlbaker4 on February 25, 2008, 06:03:29 PM
It is showing as included...

what exactlly do you mean?
that you included it with#include "cstacls5.lib"or that you included it with #use "cstacls5.lib"
and are you #including an .inc file which declares all those functions?

Just basing questions on what I do in EBasic.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

mlbaker4

I imported the library into the compiler it is shown in the resource page

LarryMc

February 25, 2008, 08:44:34 PM #12 Last Edit: February 25, 2008, 08:50:10 PM by Larry McCaughn
It's my understanding that a .lib is NOT added as a resource.

Look at the internet_explorer.src to see how a .lib file is used.
Also see
Aurora\examples\classmaker\classmaker.src(1): #use "advapi32.lib"
Aurora\examples\classmaker.src(1): #use "advapi32.lib"
Aurora\examples\shell_com_example.src(1): #use "ole32.lib"
Aurora\examples\shell_com_example.src(2): #use "uuid.lib"
Aurora\imgeditor\ibssim.src(12):    $use "irun.lib"
Aurora\imgeditor\ibssim.src(13):    $use "sbdll.lib"
Aurora\imgeditor\pic_class.src(5): #use "oleaut32.lib"


Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

mlbaker4

I am doing better I think this is the following compiler statements and error.Compiling... I am not sure what i am missing for the main, most of the original problems were having files in a different folder and even after I moved them, the project was still looking at the old location
cserror5.inc
csrtkey5.inc
cstools5.inc
Timer.src
Connect.src
MainWnd.src
Telnet.src
Clipboard.inc
Connect.inc
MainWnd.inc
Telnet.inc
Timer.inc
Clipboard.src
Resource.inc
LoadString.src

Linking...
Aurora Linker v1.0 Copyright ÂÃ,©2005,2006 Ionic Wind Software
Unresolved external main
Error: Unresolved extern main
Error(s) in linking Terminal.exe



Mike Stefanik

February 26, 2008, 09:41:32 AM #14 Last Edit: February 26, 2008, 09:43:12 AM by Mike Stefanik
The main() function, which contains the starting code for your program, is in the MainWnd.src module. That same module is also what implements the CMainWnd class, which is used to host the terminal emulation view. Based on your list above, it looks like it's being compiled, so I'm not sure why the linker is complaining about not finding it.
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

mlbaker4

I Think I fiund the problem, in csrtkey5.inc it doesn't like this statement string CSTOOLS5_LICENSE_KEY = "";   I had originally remarke out the line and everything seemed to compile, I had for got this and when I just went back to un remark it out, When I compiled I got a lot of errors:

It appears it does not like the word String:

Compiling...
Timer.src
File: csrtkey5.inc (18) STRING: Initializer not supported
Error(s) in compiling "C:\Program Files\Aurora\examples\Timer.src"
Connect.src
File: csrtkey5.inc (18) STRING: Initializer not supported
Error(s) in compiling "C:\Program Files\Aurora\examples\Connect.src"
LoadString.src
Telnet.src
File: csrtkey5.inc (18) STRING: Initializer not supported
Error(s) in compiling "C:\Program Files\Aurora\examples\Telnet.src"
MainWnd.src
File: csrtkey5.inc (18) STRING: Initializer not supported
Error(s) in compiling "C:\Program Files\Aurora\examples\MainWnd.src"
Clipboard.src
csrtkey5.inc
cserror5.inc
Telnet.inc
File: csrtkey5.inc (18) STRING: Initializer not supported
Error(s) in compiling "C:\Program Files\Aurora\include\Telnet.inc"
cstools5.inc
File: csrtkey5.inc (18) STRING: Initializer not supported
Error(s) in compiling "C:\Program Files\Aurora\include\cstools5.inc"
MainWnd.inc
File: csrtkey5.inc (18) STRING: Initializer not supported
Error(s) in compiling "C:\Program Files\Aurora\include\MainWnd.inc"
Timer.inc
Clipboard.inc
Connect.inc
Resource.inc

Mike Stefanik

Something must have changed with the language then, the last time I had compiled those examples (which was quite a while ago, admittedly) there wasn't a problem. Kind of strange that the current version apparently doesn't like initializing string values.

In any case, it's easy to work around. Just comment it out, and wherever you see it in a source file, replace it with an empty string literal.
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

mlbaker4

Mike

  I recopied all the files and put them in the correct directories on Aurora, it compiled and worked the first time. The only problem I had is one of the systems I have needs local echo, and it wasn't an option. So as a new programmer I plan to trt to move my windows elements into your main and see what happens and if I can figure out how to automate many of the items, directories.

  This is a great start, and is definatly heading me the right direction, as soon as I can make sure this combination will suite my needs I will purchase which ever of your products you feel I shoue buy.

  I am very grateful to the help you and guidence you have given me and your products are wort every penny I will spend.  I have started this project numerous times in variations of BASIC, C++ Builder ran into problems with th Microsoft Express studio, and Iran into problems with the telnet piece everytime. I could get the gui built, menus, and basic functions, but without the telnet piece it was all a waste of time.



Thank you very much\
Mike

mlbaker4

Well I am still having a few problems,

if I put the statement g_pMainWnd->SetWindowColor (RGB (64,0,130)); after the config window statement the default window color does not change.
how is the IP address put in the statement if (g_pClient->Connect(192.168.1.14,23) = false) I keep getting an error on the .1  I habe tried usinig 001 and get the same error just with the .001. I am trying to define the connections to set IP and port numbers with no time out.

I also can't get the charachter to echo on systems that need that, and is some instances I need to send a Control Enter to get to the next line and a few others a Control J.  Where  are the emulations defined? I have specifications on some of what I need. I have tried all three built in emulations without much success. But I have added the Menus, and am farther than I have ever been.

I hope someone can shed some light on this, it really looks like this product with this compiler works very well, and the cost is minimual, if a few bugs are wworked out, and it is proabably all me as a Newbie. Maybe after all this I can become a Newbie Grade 2.

Mike

Mike Stefanik

To change display colors, use the SetForeColor, SetBackColor methods (or call ChooseColor and let the user pick). If you look at the class implementation, you'll see that it ends up calling functions like NvtSetDisplayForeColor, which is what's needed to change emulation colors. Depending on what else you're doing, you may also need to redraw the window to update it.

If you want to enable local character echoing, then call the SetLocalEcho method such as: g_pMainWnd->SetLocalEcho(true) and that should do it. The source for all of this is in the csnvtcls.src file, so you can look in there and see how it's handled internally.

With the Connect method, the first argument is a string: g_pClient->Connect("192.168.1.14", 23) and if you want to send individual characters to the server, use the WriteChar method: g_pClient->WriteChar('A')
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

mlbaker4

I can't get the local echo to work or a connect, I have tried to copy various statements but I guess I am just to stupid to figure it out. It is connecting bit I get the following error:

Invalid handle passed to function

Here is the connection statements

sub OnColuTelnet (CMainWnd *g_pMainWnd)
{
   
   g_pMainWnd->SetLocalEcho(true);
   g_pClient->Connect("192.168.1.14",23);
   g_pClient->SetTerminalType("ansi");
   
      g_pClient->ShowError();
      return 0;
}

I knoe your probably tired of helping and I am truely sorry, I have been able to get the other parts working slowely and with your help.


LarryMc

Quote from: mlbaker4 on February 26, 2008, 04:59:33 PM
...I am just to stupid to figure it out...
...I knoe your probably tired of helping.....

We ALL feel "stupid" at times, no one moreso than me.  So forget that!

As you spend more time here on the forum you'll find that people don't get tired of helping.  That's the primary purpose of the forum.

But you also will find that certain members have expertice in certain areas.  The more complicated the question the fewer the people with the necessary knowledge.  Since those experts have lives other than the forum you have to just ask your questions and wait for a reply.

Now, there are a few people who seem to be experts in just about everything but they get spread thin because they are the ones that answer the most "hard" questions.

People like me answer questions that tend to be the much easier questions.

When we see questions in the area you are dealing with we know lest than you do.

Be patience, ask questions, have fun, and it will all come together.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Mike Stefanik

The code that you're apparently trying to write is already in the Terminal example. Take a look at the OnMenuConnect method to see how it's implemented. That example is also one of the more complex ones, primarily because it involves two different libraries, so you've picked kind of a steep hill to climb right from the start; I'd recommend making small, incremental changes to the existing code rather than trying to write your own at the start.

One other thing that is important to keep in mind is that you should always check return values. For example, try:


if (g_pClient->Connect("192.168.1.14", 23) == false)
{
    g_pClient->ShowError();
}


That will show a message box that describes the error that has occurred if the method fails. Never simply assume that a particular method will succeed.
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

mlbaker4

Till not having much luck I thinl I will start a new project tonight and try to start wit just a basic connect with a simple window.

Rock Ridge Farm (Larry)

You can download the putty/psftp libs for free - you can get source and executable.
Could be another way to try it.