Re: [twsocket] multithread server

2011-08-17 Thread Lukáš Skála

hi,
I always call Receive (even if RcvdCount returns zero). When RcvdCount 
returns zero then Receive returns -1 value. Is it normal?
What is property Multithreaded in TWServerSocket? Should it be set to 
TRUE? In demo application property is set to FALSE and only client 
sockets are set to TRUE.


Now I have no idea where is problem with service hanging. Any idea where 
to look is welcome.

Thanks
Lukas Skala


Dne 17.8.2011 18:18, Wilfried Mestdagh napsal(a):

Hi,

If OnDataAvailable triggers then you have to try to receive data, even if 
RcvdCount (wich is unreliable) returns 0. If you don't receive then 
OnDataAvailable will be called again in a closed loop en that is probably what 
happens.




--
lukas skala
envinet a.s.
divize projektu a inzenyringu (project and engineering division)
modrinova 1094
674 01 trebic

tel: +420 568 409 862 (811)
fax: +420 568 409 875
gsm: +420 724 461 062
icq: 66842878
eml: lukas.sk...@envinet.cz, luky.sk...@gmail.com
www: http://envinet.cz




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


[twsocket] ICS v5: Raw sockets

2011-08-17 Thread Koker, Mohamed (GE Energy)
Hi Folks,

Is it  possible to use raw sockets with ICS v5?

I am using Delphi 2007 but each time I try to set this up, I get a
failure when binding i.e. after invoking the Listen method.

Thanks in advance

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


Re: [twsocket] SSL and TLS for TSmtpCli

2011-08-17 Thread Arno Garrels
Neal Barnett wrote:
> Arno -
> 
>> or
>> Encrypted Connection: SSL
>> Port: 465
> 
>>> This is commonly SSL-type "Implicit (TLS Connection)".
>>> The difference between Implicit and Explicit is that Implicit
>>> establishes 
> a secure SSL/TLS connection and Explicit starts with a plain text
>>> connection that is turned into a secure connection later when the
>>> client sends the "STARTTLS" command. 
> 
> So, how would I use this method "Implicit (TLS Connection)" in
> TSmtpCli? 
> 
>> For example, if I wish to send using:
>> Encrypted Connection: TLS
>> Port: 587
> 
>>> That port can be used if the ISP has blocked SMTP port #25 and the
> mailserver services port #587 as well. Such as
>>> smtp.googlemail.com.  The SSL-type on that port is commonly
>>> "Explicit (STARTTLS)". 
> 
> And how would I use this method in TSmtpCli?

Instead of TSmtpCli you have to use TSslSmtpCli plus a linked 
TSslContext. Take a look at the OverbyteIcsSslMailSnd sample in
ICS sub directory SslInternet, get a free GMail account and play
with the demo. And don't forget to download the OpenSSL libraries
from http://wiki.overbyte.be/wiki/index.php/ICS_Download.

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


Re: [twsocket] multithread server

2011-08-17 Thread Wilfried Mestdagh
Hi,

If OnDataAvailable triggers then you have to try to receive data, even if 
RcvdCount (wich is unreliable) returns 0. If you don't receive then 
OnDataAvailable will be called again in a closed loop en that is probably what 
happens.

-- 
mvg, Wilfried
http://www.mestdagh.biz
http://www.comfortsoftware.be
http://www.expertsoftware.be

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


Re: [twsocket] SSL and TLS for TSmtpCli

2011-08-17 Thread Neal Barnett
Arno -

> or
> Encrypted Connection: SSL
> Port: 465

>>This is commonly SSL-type "Implicit (TLS Connection)".
>>The difference between Implicit and Explicit is that Implicit establishes
a secure SSL/TLS connection and Explicit starts with a plain text
>>connection that is turned into a secure connection later when the client
sends the "STARTTLS" command.

So, how would I use this method "Implicit (TLS Connection)" in TSmtpCli?

> For example, if I wish to send using:
> Encrypted Connection: TLS
> Port: 587

>>That port can be used if the ISP has blocked SMTP port #25 and the
mailserver services port #587 as well. Such as
>> smtp.googlemail.com.  The SSL-type on that port is commonly "Explicit
(STARTTLS)".

And how would I use this method in TSmtpCli?

Thanks,
--
Neal

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


Re: [twsocket] multithread server

2011-08-17 Thread Francois PIETTE
Sometimes Windows triggers OnDataAvailable when no data is actually 
available. This is how it works. It is safe to ignore it. The most important 
is to call Recv (or any derivative) anyway. Using RcvdCount to decide to 
call or no Recv is wrong. Always call Recv which is the only one to actually 
reset winsock internal flag.



francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

-Message d'origine- 
From: Lukas Skala

Sent: Wednesday, August 17, 2011 4:01 PM
To: twsocket@elists.org
Subject: [twsocket] multithread server

hello,
I have tcp server (developed as Windows Service) based on
OverbyteIcsThrdSrv1.pas demo. There is maximum of 200 clients. Server is
hanging after some time of running - it is unable to connect any new client.

I have added log in all events of TWSocketServer (оn events start line
and events end line). So I know that program is not hanging in any
events. I have some timer in service also and operation inside OnTimer
events are also logged. When server is hanged timer event is no more
triggered - it seems that main thread is very busy by triggering
OnClientDataAvailable - but in fact no data are incoming, function
RcvdCount in OnClientDataAvailable events returns zero and function
Receive returns -1 length (see part of log below please). Please what
does it means (why is this event triggered when no data are incoming?)
and how to avoid this behaviour?

17.08.11 15:42:52 I ClientDataAvailable started.
17.08.11 15:42:52 I Received from 89.24.4.161: 0 byte(s).
17.08.11 15:42:52 D Received -1 byte(s).
17.08.11 15:42:52 I ClientDataAvailable ended.

Thanks for any idea.
Lukas


--
lukas skala
envinet a.s.
divize projektu a inzenyringu (project and engineering division)
modrinova 1094
674 01 trebic

tel: +420 568 409 862 (811)
fax: +420 568 409 875
gsm: +420 724 461 062
icq: 66842878
eml: lukas.sk...@envinet.cz, luky.sk...@gmail.com
www: http://envinet.cz




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


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

Re: [twsocket] thread safety and async operation

2011-08-17 Thread Zvone
Basically you answered what I needed to know. As long as no ProcessMessages
is called it is safe to use in non-thread safe environment with single
thread. Thanks for the answer.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] multithread server

2011-08-17 Thread Lukas Skala

hello,
I have tcp server (developed as Windows Service) based on 
OverbyteIcsThrdSrv1.pas demo. There is maximum of 200 clients. Server is 
hanging after some time of running - it is unable to connect any new client.


I have added log in all events of TWSocketServer (оn events start line 
and events end line). So I know that program is not hanging in any 
events. I have some timer in service also and operation inside OnTimer 
events are also logged. When server is hanged timer event is no more 
triggered - it seems that main thread is very busy by triggering 
OnClientDataAvailable - but in fact no data are incoming, function 
RcvdCount in OnClientDataAvailable events returns zero and function 
Receive returns -1 length (see part of log below please). Please what 
does it means (why is this event triggered when no data are incoming?) 
and how to avoid this behaviour?


17.08.11 15:42:52 I ClientDataAvailable started.
17.08.11 15:42:52 I Received from 89.24.4.161: 0 byte(s).
17.08.11 15:42:52 D Received -1 byte(s).
17.08.11 15:42:52 I ClientDataAvailable ended.

Thanks for any idea.
Lukas


--
lukas skala
envinet a.s.
divize projektu a inzenyringu (project and engineering division)
modrinova 1094
674 01 trebic

tel: +420 568 409 862 (811)
fax: +420 568 409 875
gsm: +420 724 461 062
icq: 66842878
eml: lukas.sk...@envinet.cz, luky.sk...@gmail.com
www: http://envinet.cz




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