Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-07-2002, 09:37 AM
Peterbimbo Peterbimbo is offline
Junior Member
 
Join Date: Mar 2002
Posts: 2
Default Console Application with TClientSocket Object

Hi Folks,

I am developing a Console Application to execute some Telnet Scripts. Although I've the application working with a Form, I would like to implement it as a console Application, but I'm having some problems with it.

Here is the code of the console app.
program Project2;



{$APPTYPE CONSOLE}
uses
Windows,
Messages,
SysUtils,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls,
ScktComp;


var
pp: string;
aux : integer;
soc: TClientSocket;
fic1 : Textfile;


procedure Conectado;
Begin
Writeln('Conecatdo');
End;

begin
// Insert user code here

soc := TclientSocket.Create(nil);
soc.Address := '127.0.0.1';
soc.port := 32009;
soc.OnConnect := Conectado;

end.

Well, as you can guess it doesn't work because "Conectado" is a regular procedure and "OnConnect" needs a Method Pointer. I suppose I must link the procedure "conectado" with an Object, but I can't figure out how to do it.

Any help will be thanked, I'm in a great mess.

Thanked beforehand, Pedro.
Reply With Quote
  #2  
Old 03-07-2002, 09:40 AM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: Console Application with TClientSocket Object

Have a look at this post:

http://www.delphipages.com/threads/thread.cfm?ID=37780&G=37770

Or look through these posts:

http://www.delphipages.com/threads/index.cfm?LSR=1&SR=%5EgLes%20TMyEvents&SC=2&AO=and

Hope that helps...

gLes

"Today is the first day of the rest of your life"
/gLes@hab.hu/
Reply With Quote
  #3  
Old 03-07-2002, 09:53 AM
Peterbimbo Peterbimbo is offline
Junior Member
 
Join Date: Mar 2002
Posts: 2
Default RE: Console Application with TClientSocket Object

Thanks a lot. Almost a Perfect Answer. Sorry, I didn't find the elder posts.
Reply With Quote
  #4  
Old 03-07-2002, 10:32 AM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: Console Application with TClientSocket Object

No problem...

gLes

"Today is the first day of the rest of your life"
/gLes@hab.hu/
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 03:30 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.