[twsocket] TCP-based DNS resolution component?

2005-05-25 Thread Jack
Hi Francois,

I didn't receive any reply so I went ahead and added
tcp support in the DNSQuery component. If you are interested
I can email you the updated file so that you can review
the code and add to your distribution if you like.

Thanks,
Jack

===8==Original message text===
Hello all,

I didn't see the option of choosing TCP in ICS's DNS client
component. I suppose it's UDP only. I wonder if there is a
component that resolves DNS with TCP? I didn't see one on
the user made page.

-- 
Best regards,
Jack



-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TCP-based DNS resolution component?

2005-05-25 Thread Francois Piette
 I didn't receive any reply 

Strange, I replyed in the list.

 so I went ahead and added
 tcp support in the DNSQuery component. If you are interested
 I can email you the updated file so that you can review
 the code and add to your distribution if you like.

Yes, please.

--
[EMAIL PROTECTED]
http://www.overbyte.be


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Using THtmlSmtpCli

2005-05-25 Thread Bjørnar Nielsen

I'm going to make a mail-client for sending email, and I think about using
THtmlSmtpCli.

CharSet seems to be default to iso-8859-1. When using non-english chars in
the content of the email, and names to sender in the header, must I encode
to this iso-format my self before setting the properties, or is this done
automaticly when setting or sending the mail?

If I must encode my self which component should I use, MimeDec? Is
encoding/decoding of wide chars also possible, or must I then use utf8
instead?

If a non-html-enabled mail client receives a mail sent with html and
THtmlSmtpCli, will it show the plain text part instead of the html?

Regards Bjørnar



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Telnet

2005-05-25 Thread Arnoldo - Optextil

Hi,

About redirect connection, in my small project this worked well !

Thanks François and another members of ICS list.

Arnoldo

- Original Message - 
From: Francois PIETTE [EMAIL PROTECTED]

To: ICS support mailing twsocket@elists.org
Sent: Tuesday, May 24, 2005 1:51 PM
Subject: Re: [twsocket] Telnet



I have found this article explainign how to inherit from a socket handle:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/shared_sockets_2.asp

--
[EMAIL PROTECTED]
http://www.overbyte.be

- Original Message - 
From: Francois Piette [EMAIL PROTECTED]

To: ICS support mailing twsocket@elists.org
Sent: Tuesday, May 24, 2005 4:33 PM
Subject: Re: [twsocket] Telnet



   ShellExecute(Application.Handle, 'open', @ClientFileName,

@ClientParams,

 @ClientDir, SW_SHOW);

I'm not sure you can use ShellExecute to inherit handles. Use

CreateProcess which has a parameter

bInheritHandles.

 to server with telnet 127.0.0.1 5000... The client project is

executed,

 but show message 10038.

Error 10038 means you pass a handle to winsock that is not a socket

handle. In your case, the handle

is not inherited from the parent process.

--
[EMAIL PROTECTED]
http://www.overbyte.be


- Original Message - 
From: Arnoldo - Optextil [EMAIL PROTECTED]

To: ICS support mailing twsocket@elists.org
Sent: Tuesday, May 24, 2005 3:23 PM
Subject: Re: [twsocket] Telnet


 Hi,

 About redirect the connection, I created two small projects, exemplify

the

 problem !

 Server:

 unit UServer;

 interface

 uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,

Forms,

   Dialogs, WSocket, SHELLAPI;

 type
   TForm1 = class(TForm)
 SrvSocket: TWSocket;
 procedure FormCreate(Sender: TObject);
 procedure SrvSocketSessionAvailable(Sender: TObject; ErrCode: 
 Word);

   private
 { Private declarations }
   public
 { Public declarations }
   end;

 var
   Form1: TForm1;

 implementation

 {$R *.dfm}

 procedure TForm1.FormCreate(Sender: TObject);
 begin
   SrvSocket.Close;
   SrvSocket.Addr  := '0.0.0.0';  { Use any interface for listening }
   SrvSocket.Proto := 'tcp';
   SrvSocket.Port  := '5000';
   SrvSocket.Listen;
 end;

 procedure TForm1.SrvSocketSessionAvailable(Sender: TObject; ErrCode:

Word);

 var
   ClientFileName, ClientParams, ClientDir : array [0..255] of char;
   NewHSocket : TSocket;
 begin
   NewHSocket := SrvSocket.Accept;
   StrPCopy(@ClientFileName, 'c:\rf\projectcliente.exe');
   StrPCopy(@ClientParams, ''+ inttostr(newhsocket));
   StrPCopy(@ClientDir, 'c:\rf\');
   ShellExecute(Application.Handle, 'open', @ClientFileName,

@ClientParams,

 @ClientDir, SW_SHOW);
 end;

 Client:

 unit UCliente;

 interface

 uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,

Forms,

   Dialogs, WSocket, Spin, StdCtrls, Buttons, WinSock;

 type
   TForm2 = class(TForm)
 Socket: TWSocket;
 Memo: TMemo;
 procedure SocketDataAvailable(Sender: TObject; ErrCode: Word);
 procedure FormCreate(Sender: TObject);
   private
 { Private declarations }
   public
 { Public declarations }
   end;

 var
   Form2: TForm2;

 implementation

 {$R *.dfm}

 procedure TForm2.SocketDataAvailable(Sender: TObject; ErrCode: Word);
 var
 Buffer : array [0..1023] of char;
 Len : Integer;
 begin
   Len := Socket.Receive(@Buffer, SizeOf(Buffer) - 1);
   if Len = 0 then
  Exit;

   Buffer[Len]   := #0;
   Memo.lines.add(StrPas(Buffer));
 end;

 procedure TForm2.FormCreate(Sender: TObject);
 var
   NewHSocket : TSocket;
 begin
   if  paramcount = 1 then
   Begin
 caption := ParamStr(1);
 NewHSocket := StrToIntDef(ParamStr(1),0);
 Socket.Dup(NewHSocket);
   End;
 end;

 Running this example, the server is listen on port 5000, on prompt I

connect

 to server with telnet 127.0.0.1 5000... The client project is

executed,

 but
 show message 10038.

 When you say: Once you have the
 socket handle for the accepted connection, you may start another

process,

 make it inherit the handle and let him process the connection. The

second
 process may use TWSocket and receive the inherited handle using Dup(). 
 


 The implementation above is correct ? If not, have a sample ?

 Thanks

 Arnoldo

 - Original Message - 
 From: Francois PIETTE [EMAIL PROTECTED]

 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, May 21, 2005 4:41 AM
 Subject: Re: [twsocket] Telnet


  I'm not reinventing the wheel. I saw your samples programs about
  TWSocketServer too. My problem not is work with various instances of
  clients. My problem is when the client connect the server, the 
  server

  redirect the connection to another application. I have the

Socket.Accept,

  I
  run another application, in this another application who I do

establish

  connection with the client ? It's possible ?
 
  Altough I have nerver done this, I think it is possible. Once you 
  have

the

  

Re: [twsocket] Telnet

2005-05-25 Thread Arnoldo - Optextil
Ok, no problem, but I send a email to you two hours earlier, in private, 
suggesting this... :)


Arnoldo
- Original Message - 
From: Francois Piette [EMAIL PROTECTED]

To: ICS support mailing twsocket@elists.org
Sent: Wednesday, May 25, 2005 11:35 AM
Subject: Re: [twsocket] Telnet



About redirect connection, in my small project this worked well !


It would be interesting to publish your small project on the usermade page 
at ICS website.

--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be


- Original Message - 
From: Arnoldo - Optextil [EMAIL PROTECTED]

To: ICS support mailing twsocket@elists.org
Sent: Wednesday, May 25, 2005 3:10 PM
Subject: Re: [twsocket] Telnet



Hi,

About redirect connection, in my small project this worked well !

Thanks François and another members of ICS list.

Arnoldo

- Original Message - 
From: Francois PIETTE [EMAIL PROTECTED]

To: ICS support mailing twsocket@elists.org
Sent: Tuesday, May 24, 2005 1:51 PM
Subject: Re: [twsocket] Telnet


I have found this article explainign how to inherit from a socket 
handle:




http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/shared_sockets_2.asp


 --
 [EMAIL PROTECTED]
 http://www.overbyte.be

 - Original Message - 
 From: Francois Piette [EMAIL PROTECTED]

 To: ICS support mailing twsocket@elists.org
 Sent: Tuesday, May 24, 2005 4:33 PM
 Subject: Re: [twsocket] Telnet


ShellExecute(Application.Handle, 'open', @ClientFileName,
 @ClientParams,
  @ClientDir, SW_SHOW);

 I'm not sure you can use ShellExecute to inherit handles. Use
 CreateProcess which has a parameter
 bInheritHandles.

  to server with telnet 127.0.0.1 5000... The client project is
 executed,
  but show message 10038.

 Error 10038 means you pass a handle to winsock that is not a socket
 handle. In your case, the handle
 is not inherited from the parent process.

 --
 [EMAIL PROTECTED]
 http://www.overbyte.be


 - Original Message - 
 From: Arnoldo - Optextil [EMAIL PROTECTED]

 To: ICS support mailing twsocket@elists.org
 Sent: Tuesday, May 24, 2005 3:23 PM
 Subject: Re: [twsocket] Telnet


  Hi,
 
  About redirect the connection, I created two small projects, 
  exemplify

 the
  problem !
 
  Server:
 
  unit UServer;
 
  interface
 
  uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, 
  Controls,

 Forms,
Dialogs, WSocket, SHELLAPI;
 
  type
TForm1 = class(TForm)
  SrvSocket: TWSocket;
  procedure FormCreate(Sender: TObject);
  procedure SrvSocketSessionAvailable(Sender: TObject; ErrCode:
  Word);
private
  { Private declarations }
public
  { Public declarations }
end;
 
  var
Form1: TForm1;
 
  implementation
 
  {$R *.dfm}
 
  procedure TForm1.FormCreate(Sender: TObject);
  begin
SrvSocket.Close;
SrvSocket.Addr  := '0.0.0.0';  { Use any interface for listening }
SrvSocket.Proto := 'tcp';
SrvSocket.Port  := '5000';
SrvSocket.Listen;
  end;
 
  procedure TForm1.SrvSocketSessionAvailable(Sender: TObject; ErrCode:
 Word);
  var
ClientFileName, ClientParams, ClientDir : array [0..255] of char;
NewHSocket : TSocket;
  begin
NewHSocket := SrvSocket.Accept;
StrPCopy(@ClientFileName, 'c:\rf\projectcliente.exe');
StrPCopy(@ClientParams, ''+ inttostr(newhsocket));
StrPCopy(@ClientDir, 'c:\rf\');
ShellExecute(Application.Handle, 'open', @ClientFileName,
 @ClientParams,
  @ClientDir, SW_SHOW);
  end;
 
  Client:
 
  unit UCliente;
 
  interface
 
  uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, 
  Controls,

 Forms,
Dialogs, WSocket, Spin, StdCtrls, Buttons, WinSock;
 
  type
TForm2 = class(TForm)
  Socket: TWSocket;
  Memo: TMemo;
  procedure SocketDataAvailable(Sender: TObject; ErrCode: Word);
  procedure FormCreate(Sender: TObject);
private
  { Private declarations }
public
  { Public declarations }
end;
 
  var
Form2: TForm2;
 
  implementation
 
  {$R *.dfm}
 
  procedure TForm2.SocketDataAvailable(Sender: TObject; ErrCode: 
  Word);

  var
  Buffer : array [0..1023] of char;
  Len : Integer;
  begin
Len := Socket.Receive(@Buffer, SizeOf(Buffer) - 1);
if Len = 0 then
   Exit;
 
Buffer[Len]   := #0;
Memo.lines.add(StrPas(Buffer));
  end;
 
  procedure TForm2.FormCreate(Sender: TObject);
  var
NewHSocket : TSocket;
  begin
if  paramcount = 1 then
Begin
  caption := ParamStr(1);
  NewHSocket := StrToIntDef(ParamStr(1),0);
  Socket.Dup(NewHSocket);
End;
  end;
 
  Running this example, the server is listen on port 5000, on prompt I
 connect
  to server with telnet 127.0.0.1 5000... The client project is
 executed,
  but
  show message 10038.
 
  When you say: Once you have the
  socket handle for the accepted connection, you may start another