Re: [twsocket] TWSocket OnSessionAvailable problem

2011-07-21 Thread MFischer

Hello,

i don't think that this could be the problem, because on netstat -a are no
sockets in TIME_WAIT related to the server process. And all client-sockets are
in state Established, the only matter is the in the server component the
OnSessionAvaiable-Callback is not called.

 twsocket-boun...@elists.org schrieb am 20.07.2011 17:16:30:
 Re: [twsocket] TWSocket OnSessionAvailable problem
 Wilfried Mestdagh
 an:
 'ICS support mailing'
 20.07.2011 17:18
 Gesendet von:
 twsocket-boun...@elists.org

 Hi,

 Maybe too many sockets in TIME_WAIT? You can chech this with netstat -a

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


  -Oorspronkelijk bericht-
  Van: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org]
  Namens mfisc...@bfe.tv
  Verzonden: woensdag 20 juli 2011 11:44
  Aan: twsocket@elists.org
  Onderwerp: [twsocket] TWSocket OnSessionAvailable problem
 
 
 
  Hi,
  i am using the Standard TWSocket in a Server and round about 30 Clients
  in
  LineMode. After a Client is connected to the Server, the Client starts
  immediately to send text messages. After some sort of filtering the
  messages
  are broadcasted to a subset of all connected Clients. If i start the
  sever and
  30 clients through a script on a single Windows 7 PC the following
  error
  occurs: After 23-26 Clients get connected, the server no longer calls
  the
  callback function for OnSessionAvailable, but at client-side the
  callback for
  OnSessionConnected is still activated and the ClientSocket stays in
  state
  wsConnected. If i look at TCPView the corresponding Connection has the
  state
  Established. OnError or OnBGException are not called and the Socket
  is still
  in listening-State. If the Listening  Socket is Destroyed and
  recreated
  everything works in a certain way. Any idea in which direction my
  problem
  could be located?
  Thanks,
   M. Fischer
  --
  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
--
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] TWSocket OnSessionAvailable problem

2011-07-21 Thread MFischer
I tried although the TWSocketServer Component and encountered the same
problem.
Same with different Versions of ICS. i have tried with an older version and
ICS-V6 from overbyte.be with Delphi 2006.
Maybe i should try with ICS-V7?


 twsocket-boun...@elists.org schrieb am 20.07.2011 18:27:56:
 Re: [twsocket] TWSocket OnSessionAvailable problem
 Arno Garrels
 an:
 ICS support mailing
 20.07.2011 18:28
 Gesendet von:
 twsocket-boun...@elists.org

 mfisc...@bfe.tv wrote:
  Hi,
  i am using the Standard TWSocket in a Server and round about 30
  Clients in LineMode. After a Client is connected to the Server, the
  Client starts immediately to send text messages. After some sort of
  filtering the messages are broadcasted to a subset of all connected
  Clients. If i start the sever and 30 clients through a script on a
  single Windows 7 PC the following error occurs: After 23-26 Clients
  get connected, the server no longer calls the callback function for
  OnSessionAvailable, but at client-side the callback for
  OnSessionConnected is still activated and the ClientSocket stays in
  state wsConnected. If i look at TCPView the corresponding Connection
  has the state Established. OnError or OnBGException are not called
  and the Socket is still in listening-State. If the Listening
  Socket is Destroyed and recreated everything works in a certain way.
  Any idea in which direction my problem could be located?

 Don't you use the TWSocketServer component?
 What version of ICS do you use and where did you download it?

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

2011-07-21 Thread Arno Garrels
mfisc...@bfe.tv wrote:
 I tried although the TWSocketServer Component and encountered the same
 problem.
 Same with different Versions of ICS. i have tried with an older
 version and ICS-V6 from overbyte.be with Delphi 2006.
 Maybe i should try with ICS-V7?

Yes, please use ICSv7 and if possible TWSocketServer.
Then try to include wsoNoReceiveLoop in the ComponentOptions 
of the TWSocketClient instances. Also try to assign a greater 
value to property ListenBackLog of the TWSocketServer component.

And of course avoid any lengthy blocking tasks since they also
delay/block acceptance of new connections (though buffered by 
winsock thru the ListenBackLogQueue). 

Did that work?

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

2011-07-21 Thread Arno Garrels
Arno Garrels wrote:
 mfisc...@bfe.tv wrote:
 I tried although the TWSocketServer Component and encountered the
 same problem.
 Same with different Versions of ICS. i have tried with an older
 version and ICS-V6 from overbyte.be with Delphi 2006.
 Maybe i should try with ICS-V7?
 
 Yes, please use ICSv7 and if possible TWSocketServer.

Forgot to post the download link:
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


[twsocket] Antwort: Re: TWSocket OnSessionAvailable problem

2011-07-21 Thread MFischer
 twsocket-boun...@elists.org schrieb am 21.07.2011 09:44:43:
 Re: [twsocket] TWSocket OnSessionAvailable problem
 Arno Garrels
 an:
 ICS support mailing
 21.07.2011 09:45
 Gesendet von:
 twsocket-boun...@elists.org

 Yes, please use ICSv7 and if possible TWSocketServer.
 Then try to include wsoNoReceiveLoop in the ComponentOptions
 of the TWSocketClient instances. Also try to assign a greater
 value to property ListenBackLog of the TWSocketServer component.

 And of course avoid any lengthy blocking tasks since they also
 delay/block acceptance of new connections (though buffered by
 winsock thru the ListenBackLogQueue).

 Did that work?

With ICSv7 and wsoNoReceiveLoop ComponentOption set, all my problems are
solved.
Thanks a lot especially for the very fast answers.
--
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] TWSocket.Close() blocks on certainmachines aftersending UDP

2011-07-21 Thread Merijn Bosma

Hi all,

Still working on this issues, I have a lot of (confusing) test results, 
will not post it all here.

I will definitely post the outcome of the investigation.

For now a question. For me it seems atm that about half of the machines 
I install now simply give this strange behavior.
I would like to ask ppl who have a Windows 7 installation if they 
recognize this, maybe someone even has a recent Windows 7 installation?
I know Francois has seen this before on Vista, only on Vista. Francois, 
do you have any Win7 machines you could test on?


I can supply source + exe and instructions of needed but I'd rather not 
dump right into the mailinglist.


Thanks all!

Merijn

On 7/13/2011 16:31, Francois PIETTE wrote:
I just made a nice discovery. I found out that I had another machine 
(same model, but mini tower) sitting here somewhere. I checked, and 
the problem does not show there.


So I took the hard drive from the not working one and put it in the 
working one and it booted nicely (since hardware is identical). The 
problem moved too!
So I have a hard drive, which contains a super fresh copy of Windows 
7 which does not work, and another hard drive with an older Windows 7 
installation which does work.


This confirm what I said before: the problem comes from a software 
installed on the not working computer, not from the hardware. It is 
likely a difference in some driver.



Any tips or question what to compare or test?


First do an image of the working installation so that you can come 
back later to it after testing !
Then on the working machine do a windows update, and an update of 
evreything you can think off and check if it becomes a not working 
installation. If it does, then you have to find out exactly which 
update break the operation.


MsInfo32 could be an help to comprae both computers. The running 
tasks list gives the version number of each module. You can see if 
they are the same or not.


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

--
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] squid NTLM proxy support

2011-07-21 Thread Arno Garrels
emanuele bizzarri wrote:
 Hi,
 in order to support squid proxy with NTLM auth, I've made some changes
 to ics source code.
 The problem I found was related to unicode, not supported by squid.

Hello Emanuele,

I agree with you that OverbyteIcsNtlmMsgs.pas only supports Unicode
NTLM messages. However I recently implemented proxy support in TWSocket
and tested that stuff against Squid proxy, it did work with current 
OverbyteIcsNtlmMsgs.pas fine. So at least that version of Squid I used 
for testing must have supported Unicode.

If this actually requires a fix there should be a solution that can 
be used in all components not just a separate fix for the HTTP client
IMO.
Whether Unicode or OEM strings are used in the NTLM communication
should be an implementation detail hidden to the component user.
Your fix doesn't fix for instance the NtlmGetMessage2 result, 
I wonder what the TNTLM_Msg2_Info result looks like with your proxy?

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


[twsocket] how to legally close and free client

2011-07-21 Thread Lukas Skala

hello,
I have server application based on TWSocketServer, clients are derived 
from TWSocketClient class.
I need disconnect inactive clients. I'm not sure how to disconnect 
client, I'm using this:


procedure DisconnectMyClient(i: Integer);
var
  C: TTcpSrvClient;
  {TTcpSrvClient = class(TWSocketClient)}
begin
C := Server.Client[I] as TTcpSrvClient;
C.Close;
C.Free; {Is this correct? sometimes it will throw access violation here}
end;


I'm using ICS v6.

I did notice that Server.OnClientDisconnect event is not triggered when 
client is not closed correctly (e.g. client is plugged of ethernet). Is 
there any possibility to detect and/or disconnect these clients 
automatically?


thank you for any answer and your time.
lukas



--
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] how to legally close and free client

2011-07-21 Thread Arno Garrels
Lukas Skala wrote:
 hello,
 I have server application based on TWSocketServer, clients are derived
 from TWSocketClient class.
 I need disconnect inactive clients. I'm not sure how to disconnect
 client, I'm using this:
 
 procedure DisconnectMyClient(i: Integer);
 var
   C: TTcpSrvClient;
   {TTcpSrvClient = class(TWSocketClient)}
 begin
 C := Server.Client[I] as TTcpSrvClient;
 C.Close;

That works, though Server.Client[I].Close would be enough.

If want to close clients while iterating over the client list
make sure you iterate from high index down to zero like:
 
for I := Server.ClientCount -1 downto 0 do
  Server.Client[I].Close;

A more brutal method to enforce client close was
Server.Disconnect().

 C.Free; {Is this correct? sometimes it will throw access violation
 here} end;

That's wrong, don't do that. Client objects are freed and 
removed from the internal client list when they are closed
or disconnected automatically by the server.

 
 
 I'm using ICS v6.

You should update to ICSv7.

 
 I did notice that Server.OnClientDisconnect event is not triggered
 when client is not closed correctly (e.g. client is plugged of
 ethernet). 

That's the expected behaviour. 

 Is there any possibility to detect and/or disconnect these
 clients automatically?

Implement an idle timeout at the server side. Let the client send
some keep alive data in intervals so the server knows a client is
still there.   

-- 
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] how to legally close and free client

2011-07-21 Thread Lukas Skala


hello,
thank for quick and useful response.
i'll try to upgrade to V7 now because i'm still getting error (catched by
Server.OnBgException event), I'm getting AccessViolation or
InvalidOperation exceptions.
These errors occurs after disconnecting client by server (i'm using
timer - in same way as you adviced me). I have tried to add C.Free call
but I have thought it was nonse (you have confirmed it me).

One question for sure:

When I call Client.Close the Client will be freed automatically
(destructor of Client will be called)?

thank you again
have a nice day
lukas skala



Dne 21.7.2011 17:29, Arno Garrels napsal(a):

 Lukas Skala wrote:

 hello,
 I have server application based on TWSocketServer, clients are derived
 from TWSocketClient class.
 I need disconnect inactive clients. I'm not sure how to disconnect
 client, I'm using this:

 procedure DisconnectMyClient(i: Integer);
 var
C: TTcpSrvClient;
{TTcpSrvClient = class(TWSocketClient)}
 begin
 C := Server.Client[I] as TTcpSrvClient;
 C.Close;

 That works, though Server.Client[I].Close would be enough.

 If want to close clients while iterating over the client list
 make sure you iterate from high index down to zero like:

 for I := Server.ClientCount -1 downto 0 do
Server.Client[I].Close;

 A more brutal method to enforce client close was
 Server.Disconnect().


 C.Free; {Is this correct? sometimes it will throw access violation
 here} end;

 That's wrong, don't do that. Client objects are freed and
 removed from the internal client list when they are closed
 or disconnected automatically by the server.



 I'm using ICS v6.

 You should update to ICSv7.


 I did notice that Server.OnClientDisconnect event is not triggered
 when client is not closed correctly (e.g. client is plugged of
 ethernet).

 That's the expected behaviour.


 Is there any possibility to detect and/or disconnect these
 clients automatically?

 Implement an idle timeout at the server side. Let the client send
 some keep alive data in intervals so the server knows a client is
 still there.








--
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] how to legally close and free client

2011-07-21 Thread Arno Garrels
Lukas Skala wrote:
 hello,
 thank for quick and useful response.
 i'll try to upgrade to V7 now because i'm still getting error
 (catched by Server.OnBgException event), I'm getting AccessViolation
 or InvalidOperation exceptions.

Sounds like you are accessing pointers or objects when they have been
already freed. 

 These errors occurs after disconnecting client by server (i'm using
 timer - in same way as you adviced me).

Huh? I haven't advised how to use a TTimer.
Using a timer might be tricky and the reason for your problem.
An example of using a timer to detect client timeouts is
THttpServer that encapsulates a TWSocketServer component.
It uses method TWSocketServer.Disconnect() to close timed out
clients in procedure THttpServer.HeartBeatOnTimer(Sender: TObject);. 

 I have tried to add C.Free
 call but I have thought it was nonse (you have confirmed it me).

Yes, the server gives and the server takes ;)

 
 One question for sure:
 
 When I call Client.Close the Client will be freed automatically
 (destructor of Client will be called)?

Yes, TWSocketServer manages the client objects, do not free them,
just Close or Disconnect them, that's all. 

-- 
Arno Garrels

 
 thank you again
 have a nice day
 lukas skala
 
 
 
 Dne 21.7.2011 17:29, Arno Garrels napsal(a):
  Lukas Skala wrote:
  hello,
  I have server application based on TWSocketServer, clients are
  derived from TWSocketClient class.
  I need disconnect inactive clients. I'm not sure how to disconnect
  client, I'm using this:
 
  procedure DisconnectMyClient(i: Integer);
  var
 C: TTcpSrvClient;
 {TTcpSrvClient = class(TWSocketClient)}
  begin
  C := Server.Client[I] as TTcpSrvClient;
  C.Close;
  That works, though Server.Client[I].Close would be enough.
 
  If want to close clients while iterating over the client list
  make sure you iterate from high index down to zero like:
 
  for I := Server.ClientCount -1 downto 0 do
 Server.Client[I].Close;
 
  A more brutal method to enforce client close was
  Server.Disconnect().
 
  C.Free; {Is this correct? sometimes it will throw access violation
  here} end;
  That's wrong, don't do that. Client objects are freed and
  removed from the internal client list when they are closed
  or disconnected automatically by the server.
 
 
  I'm using ICS v6.
  You should update to ICSv7.
 
  I did notice that Server.OnClientDisconnect event is not triggered
  when client is not closed correctly (e.g. client is plugged of
  ethernet).
  That's the expected behaviour.
 
  Is there any possibility to detect and/or disconnect these
  clients automatically?
  Implement an idle timeout at the server side. Let the client send
  some keep alive data in intervals so the server knows a client is
  still there.
--
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] how to legally close and free client

2011-07-21 Thread Wilfried Mestdagh
 When I call Client.Close the Client will be freed automatically
 (destructor of Client will be called)?

Yes. Sidenote: if you do this from withing an event then call CloseDelayed.

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


 -Oorspronkelijk bericht-
 Van: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org]
 Namens Lukas Skala
 Verzonden: donderdag 21 juli 2011 20:23
 Aan: twsocket@elists.org
 Onderwerp: Re: [twsocket] how to legally close and free client
 
 
 hello,
 thank for quick and useful response.
 i'll try to upgrade to V7 now because i'm still getting error (catched
 by
 Server.OnBgException event), I'm getting AccessViolation or
 InvalidOperation exceptions.
 These errors occurs after disconnecting client by server (i'm using
 timer - in same way as you adviced me). I have tried to add C.Free call
 but I have thought it was nonse (you have confirmed it me).
 
 One question for sure:
 
 When I call Client.Close the Client will be freed automatically
 (destructor of Client will be called)?
 
 thank you again
 have a nice day
 lukas skala
 
 
 
 Dne 21.7.2011 17:29, Arno Garrels napsal(a):
   Lukas Skala wrote:
   hello,
   I have server application based on TWSocketServer, clients are
 derived
   from TWSocketClient class.
   I need disconnect inactive clients. I'm not sure how to disconnect
   client, I'm using this:
 
   procedure DisconnectMyClient(i: Integer);
   var
  C: TTcpSrvClient;
  {TTcpSrvClient = class(TWSocketClient)}
   begin
   C := Server.Client[I] as TTcpSrvClient;
   C.Close;
   That works, though Server.Client[I].Close would be enough.
 
   If want to close clients while iterating over the client list
   make sure you iterate from high index down to zero like:
 
   for I := Server.ClientCount -1 downto 0 do
  Server.Client[I].Close;
 
   A more brutal method to enforce client close was
   Server.Disconnect().
 
   C.Free; {Is this correct? sometimes it will throw access violation
   here} end;
   That's wrong, don't do that. Client objects are freed and
   removed from the internal client list when they are closed
   or disconnected automatically by the server.
 
 
   I'm using ICS v6.
   You should update to ICSv7.
 
   I did notice that Server.OnClientDisconnect event is not triggered
   when client is not closed correctly (e.g. client is plugged of
   ethernet).
   That's the expected behaviour.
 
   Is there any possibility to detect and/or disconnect these
   clients automatically?
   Implement an idle timeout at the server side. Let the client send
   some keep alive data in intervals so the server knows a client is
   still there.
 
 
 
 
 
 
 
 --
 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


[twsocket] Socket flushing

2011-07-21 Thread Éric Fleming Bonilha
Hi

I´m having some issues with socket flushing due to the messageloop that it 
calls:

procedure TCustomWSocket.Flush;
begin
while (FHSocket  INVALID_SOCKET) and { No more socket   }
  (not bAllSent) do begin  { Nothing to send  }
{ Break; }
TryToSend;
MessagePump;
end;
end;

If I override the Flush method and remove the messagePump in my derived socket 
class:

procedure TMySocket.Flush;
begin
while (FHSocket  INVALID_SOCKET) and { No more socket   }
  (not bAllSent) do begin  { Nothing to send  }
{ Break; }
TryToSend;
end;
end;

What consequences I will have? Does this routine has the possibility to enter 
on a never ending loop without the MessagePump call?
What is the purpose of calling MessagePump over here?

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