Re: [twsocket] Hint for HTTP Server

2006-05-15 Thread Francois Piette
 how can I optimize following code statement:

What do you mean by optimize ?

 Has anyboday an idea how this code can be written easier ? 
 Maybe with an loop ??

You could probably replace the array of const by a loop. 
See how AnswerPage is implemented, you have full source code :-)

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be


- Original Message - 
From: Stefan Blankenagel [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Monday, May 15, 2006 3:07 PM
Subject: [twsocket] Hint for HTTP Server


 Hello,
 
 how can I optimize following code statement:
 
   ClientCnx.AnswerPage( Flags,
 '',
 NO_CACHE,
 sitename_system,
 nil,
 ['NOW', DateTimeToStr(Now),
 'TITLE', 'SVPC Version ' + cversion],
 'DEVICE_STATUS_01', 
 Color2Text(DeviceStatus_To_Color(SVPCSystem[1].typ, 
 SVPCSystem[1].zustand, SVPCSystem[1].zustand2, SVPCSystem[1].config)),
 'DEVICE_DESTINATION_01', Ort,
 'DEVICE_LINK_01',  sitename_device+'?device=01',
 'DEVICE_STATUS_02', 
 Color2Text(DeviceStatus_To_Color(SVPCSystem[2].typ, 
 SVPCSystem[2].zustand, SVPCSystem[2].zustand2, SVPCSystem[2].config)),
 'DEVICE_DESTINATION_02', SVPCSystem[2].Ort,
 'DEVICE_LINK_02',  sitename_device+'?device=02',
 'DEVICE_STATUS_03', 
 Color2Text(DeviceStatus_To_Color(SVPCSystem[3].typ, 
 SVPCSystem[3].zustand, SVPCSystem[3].zustand2, SVPCSystem[3].config)),
 'DEVICE_DESTINATION_03', SVPCSystem[3].Ort,
 'DEVICE_LINK_03',  sitename_device+'?device=03',
 'DEVICE_STATUS_04', 
 Color2Text(DeviceStatus_To_Color(SVPCSystem[4].typ, 
 SVPCSystem[4].zustand, SVPCSystem[4].zustand2, SVPCSystem[4].config)),
 'DEVICE_DESTINATION_04', SVPCSystem[4].Ort,
 'DEVICE_LINK_04',  sitename_device+'?device=04',
 'DEVICE_STATUS_05', 
 Color2Text(DeviceStatus_To_Color(SVPCSystem[5].typ, 
 SVPCSystem[5].zustand, SVPCSystem[5].zustand2, SVPCSystem[5].config)),
 'DEVICE_DESTINATION_05', SVPCSystem[5].Ort,
 'DEVICE_LINK_05',  sitename_device+'?device=05',
  
 'DEVICE_STATUS_32', 
 Color2Text(DeviceStatus_To_Color(SVPCSystem[32].typ, 
 SVPCSystem[32].zustand, SVPCSystem[32].zustand2, SVPCSystem[32].config)),
 'DEVICE_DESTINATION_32', SVPCSystem[32].Ort,
 'DEVICE_LINK_32',  sitename_device+'?device=32'])
 
 Has anyboday an idea how this code can be written easier ? Maybe with an 
 loop ??
 
 best regards
  Stefan
 
 -- 
 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
-- 
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] IPC - TWSocket or Named Pipes?

2006-05-15 Thread Arno Garrels
Hi,

I need to rewrite an interactive service since interactive 
services are no longer supported in Vista ;( I want to split
it into two parts, GUI and service application. The service
in question needs to be controlled locally only. What do
you suggest as the IPC protocol, TWSocket or named pipes?
Currently TWSocket appears to be an easy implementation,
but is it as fast as named pipes?

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

 
-- 
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] TWSocket

2006-05-15 Thread Stefan Blankenagel
Hi,

I am writing a little program wchich is polling another program using
TWSocketServer. For testing purposes I press a button which connects to
the other program:

procedure TForm1.Button1Click(Sender: TObject);
begin
  if icsWSocket.State   wsClosed then
icsWSocket.Close;

  if icsWSocket.State = wsClosed then begin
icsWSocket.Addr := address.Text;
icsWSocket.Port := port.Text;
icsWSocket.Connect;
Timer1.Enabled := false;
  end;
end;

In the event OnSessionConnected I send a SendStr command to get some
data. I read this with the OnDataAvailable:

procedure TForm1.icsWSocketDataAvailable(Sender: TObject; ErrCode: Word);
var inbuf : string;
begin
  inbuf := icsWSocket.ReceiveStr;

  if pos('Status', inbuf)  0 then
  begin
inbuf := StrAfter(#$FF, inbuf);
decode_data(inbuf);
icsWSocket.close;
  end;
end;

If I got the right data I want to close the connection. It is closed
then. If I press a second time the button the Connection is closed
without recieving any data and gives an error code 100053 (Connection
Aborted). Why dows this event occur ?? Normally a timer should connect
automatically every 20 seconds and get the status of the other software.

Thanks
  Stefan

-- 
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] IPC - TWSocket or Named Pipes?

2006-05-15 Thread Paul
Arno,

i have tested it onces (with a few hundred bytes data)
Didn't see much difference 
Name piped have a smaller foorprint though, they're already available.


Paul



- Original Message - 
From: Arno Garrels [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Monday, May 15, 2006 6:22 PM
Subject: [twsocket] IPC - TWSocket or Named Pipes?


 Hi,
 
 I need to rewrite an interactive service since interactive 
 services are no longer supported in Vista ;( I want to split
 it into two parts, GUI and service application. The service
 in question needs to be controlled locally only. What do
 you suggest as the IPC protocol, TWSocket or named pipes?
 Currently TWSocket appears to be an easy implementation,
 but is it as fast as named pipes?
 
 ---
 Arno Garrels [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 
 
 -- 
 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

-- 
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] IPC - TWSocket or Named Pipes?

2006-05-15 Thread Francois PIETTE
The performance should not be very different for that kind of application. 
Using a socket has the advantage of allowing easy remote administration to 
your service over standard protocol.

Note that you could also build your administration program into your service 
and use a browser as administrative tool. Just use THttpServer (Or even 
HTTPS) and write a web application to manage your service !

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be


- Original Message - 
From: Arno Garrels [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Monday, May 15, 2006 6:22 PM
Subject: [twsocket] IPC - TWSocket or Named Pipes?


 Hi,

 I need to rewrite an interactive service since interactive
 services are no longer supported in Vista ;( I want to split
 it into two parts, GUI and service application. The service
 in question needs to be controlled locally only. What do
 you suggest as the IPC protocol, TWSocket or named pipes?
 Currently TWSocket appears to be an easy implementation,
 but is it as fast as named pipes?

 ---
 Arno Garrels [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html


 -- 
 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 

-- 
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] TWSocket

2006-05-15 Thread Francois PIETTE
The normal way to gracefully close a connection is to call Shutdown(1). 
You'll then receive the OnSessionClosed even when remote part acknowledged 
the close.

 procedure TForm1.Button1Click(Sender: TObject);
 begin
  if icsWSocket.State   wsClosed then
icsWSocket.Close;

  if icsWSocket.State = wsClosed then begin
icsWSocket.Addr := address.Text;
icsWSocket.Port := port.Text;
icsWSocket.Connect;
Timer1.Enabled := false;
  end;
 end;

This is not good. Close will do have an immediate effect ! You should use 
the events !

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be

- Original Message - 
From: Stefan Blankenagel [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Monday, May 15, 2006 7:34 PM
Subject: [twsocket] TWSocket


 Hi,

 I am writing a little program wchich is polling another program using
 TWSocketServer. For testing purposes I press a button which connects to
 the other program:

 procedure TForm1.Button1Click(Sender: TObject);
 begin
  if icsWSocket.State   wsClosed then
icsWSocket.Close;

  if icsWSocket.State = wsClosed then begin
icsWSocket.Addr := address.Text;
icsWSocket.Port := port.Text;
icsWSocket.Connect;
Timer1.Enabled := false;
  end;
 end;

 In the event OnSessionConnected I send a SendStr command to get some
 data. I read this with the OnDataAvailable:

 procedure TForm1.icsWSocketDataAvailable(Sender: TObject; ErrCode: Word);
 var inbuf : string;
 begin
  inbuf := icsWSocket.ReceiveStr;

  if pos('Status', inbuf)  0 then
  begin
inbuf := StrAfter(#$FF, inbuf);
decode_data(inbuf);
icsWSocket.close;
  end;
 end;

 If I got the right data I want to close the connection. It is closed
 then. If I press a second time the button the Connection is closed
 without recieving any data and gives an error code 100053 (Connection
 Aborted). Why dows this event occur ?? Normally a timer should connect
 automatically every 20 seconds and get the status of the other software.

 Thanks
  Stefan

 -- 
 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 

-- 
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] Smtp error 452

2006-05-15 Thread Francois PIETTE
Outlook (non Express version) doesn't use SMTP, it use a MS proprietary 
protocol.
Try with Outlook Express to be in a similar situation as ICS-SMTP component.

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be


- Original Message - 
From: Tim [EMAIL PROTECTED]
To: twsocket@elists.org
Sent: Monday, May 15, 2006 6:50 PM
Subject: [twsocket] Smtp error 452


I have an email application using SmtpCli which has a test utility that
 tries to send a test email to the user. This utility uses very similar 
 code
 to the MailSnd demo included with ICS.

 It has always worked fine, but it is now having issues with sending via
 Exchange Server 2003 and I have modified the code to try and establish the
 problem.

 The responses from connecting, helo and mailfrom are:

  220 rsyncbox.fitness-exchange.net ESMTP Postfix
 HELO LMBGRD03
  250 rsyncbox.fitness-exchange.net
 MAIL FROM:[EMAIL PROTECTED]
  452 Insufficient system storage

 However, the user has no problem sending from Outlook. I can see that
 sending an email from my utility is different from sending via Outlook, 
 but
 as far as anyone can see, there is no storage problems anywhere.

 Does anyone have any ideas about what is going on?

 Thanks.
 -- 
 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 

-- 
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] SMTP demo and RichText

2006-05-15 Thread Jeff Cook
Hi
 
I'm trying out the MailSnd demo - trying to adapt it to send mail as
Rich Text.  
 
I've changed the MsgMemo to a TJvRichEdit and have tested by pasting in
some rich text - e.g. my sig below is in Comic Sans MS and I can paste
this into the message area and retain the font size etc.  
 
But when I send the mail to myself, I receive it stripped down to plain
text.  I've tried changing the ContentType to HTML but it doesn't help
(makes it worse by stripping out the CR/LF's.
 
I assume that the problem lies somewhere in procedure
TSmtpTestForm.SmtpClientGetData ... but have no idea how to proceed.  
 
Is there an easy way?  I have got ScroogeXHTML which converts a subset
of RTF to HTML - but I really want to be able to email everything in the
RichEdit.
 
TIA
 
Jeff
 
P.S. Long time user of ICS but first time user of this elist.
 
P.P.S.  Not sure how to tell what version I have - the source seems to
be dated  2001-05-19 if that helps - can't see a version number anywhere
and I am using Delphi 6 Pro.
 

--

Jeff Cook

Aspect Systems Ltd

Phone: +64-9-424 5388

Skype: jeffcooknz

HYPERLINK http://www.aspect.co.nz/www.aspect.co.nz

 

 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.392 / Virus Database: 268.5.6/340 - Release Date:
15/05/2006
 
-- 
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