Re: [twsocket] WSocketTS won't build in d2

2007-12-06 Thread DZ-Jay

On Dec 6, 2007, at 04:36, Wilfried Mestdagh wrote:

> procedure FreeAndNil(var Obj: TObject);
> begin
>  Obj.Free;
>  Obj := nil;
> end;

begin
if (Obj <> Nil) Then
Obj.Free;

 Obj := Nil;
End;

> LongWord is a Cardinal

This is correct.

dZ.

-- 
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] WSocketTS won't build in d2

2007-12-06 Thread DZ-Jay

On Dec 6, 2007, at 04:36, Wilfried Mestdagh wrote:

> from the top of my head (could be wrong for the TagMsg):
>
> procedure FreeAndNil(var Obj: TObject);
> begin
>  Obj.Free;
>  Obj := nil;
> end;
>
> LongWord is a Cardinal
> TagMsg is TMessage

I don't know in D2, but in D5+ TMessage is TagMsg, and TagMsg is a 
Record structure.  Are you saying that in D2 it's the reverse (wouldn't 
surprise me)?

dZ.

-- 
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] WSocketTS won't build in d2

2007-12-06 Thread Wilfried Mestdagh
Hello Ron,

from the top of my head (could be wrong for the TagMsg):

procedure FreeAndNil(var Obj: TObject);
begin
 Obj.Free;
 Obj := nil;
end;

LongWord is a Cardinal
TagMsg is TMessage

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Thursday, December 6, 2007, 01:58, [EMAIL PROTECTED] wrote:

> Are there some conditional defines missing from this unit? Delphi 2  
> errors on defines for FreeAndNil, Longword and TagMsg.


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

2006-03-22 Thread Fastream Technologies
Server shuts down--no longer listening. Anyway, I decided to implement and 
donate a MT web server to ICS community. So far WSocketMTSrv compiles with a 
critical section for FClient list. I am working on:

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
*}
{ Called when a session is available, that is when a client is 
nnecting   }
procedure TCustomWSocketMTServer.TriggerSessionAvailable(Error : Word);
var
Client : TWSocketMTClient;
NewHSocket : TSocket;
begin
{$IFDEF DEBUG_OUTPUT}
OutputDebugString('OnSessionAvailable');
{$ENDIF}
{ Call parent event handler }
inherited TriggerSessionAvailable(Error);
{ In case of error, do nothing }
if Error <> 0 then
Exit;

NewHSocket := Accept;
{$IFDEF DEBUG_OUTPUT}
OutputDebugString('NewHSocket = ' + IntToStr(NewHSocket));
{$ENDIF}
Inc(FClientNum);

TriggerCreateClient(Client); // var Client : TWSocketMTClient

Client.Name:= Name + 'Client' + IntToStr(FClientNum);
Client.Banner  := FBanner;
Client.Server  := Self;
{$IFNDEF NO_DEBUG_LOG}
Client.IcsLogger   := IcsLogger;   { V5.04 }
{$ENDIF}
Client.Dup(NewHSocket);
TriggerClientConnect(Client, Error);
end;

Now it is up to the user to create the TWSocketClient (=TWSocketMTClient) in 
TriggerCreateClient. I wonder if the Dup could be done in worker thread of 
not??

Thanks,

SZ

- Original Message - 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Wednesday, March 22, 2006 7:10 PM
Subject: Re: [twsocket] WSocketTS


> Fastream Technologies wrote:
>>> WaitForSingleObject would work also but is dangerous.
>>> - First object is an event handle signaled in the worker thread
>>> after the Client has called ThreadAttach.
>>> - Second object is the thread handle so if the thread thread
>>> terminates a new attempt is made to attach to another thread.
>>
>> I tried this on the single connection per thread web server. Provided 700
>> requests/sec but failed after a min (LOCKED UP).
>
> LOCKED UP = 10061??
> -- 
> 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] WSocketTS

2006-03-22 Thread Arno Garrels
Fastream Technologies wrote:
>> WaitForSingleObject would work also but is dangerous.
>> - First object is an event handle signaled in the worker thread
>> after the Client has called ThreadAttach.
>> - Second object is the thread handle so if the thread thread
>> terminates a new attempt is made to attach to another thread.
> 
> I tried this on the single connection per thread web server. Provided 700
> requests/sec but failed after a min (LOCKED UP).

LOCKED UP = 10061??
-- 
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] WSocketTS

2006-03-22 Thread Arno Garrels
Fastream Technologies wrote:
>>> So do you think this design is not mature?
>> 
>> It is working reliable. Since there may be messages in the queue for
>> the windowless client, my only idea was to block the listener thread.
>> If there's a smarter/faster way please let us know.
> 
> I do not have a better alternative for v5 but v6 promises big. IF ONLY IT
> WORKED IN C++!

I have not yet looked at V6, but I fear the basic problem, getting the
client object from one thread context into another after DUP, remains the
same.

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


Re: [twsocket] WSocketTS

2006-03-22 Thread Fastream Technologies
- Original Message - 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Wednesday, March 22, 2006 6:41 PM
Subject: Re: [twsocket] WSocketTS


> Fastream Technologies wrote:
>> My puzzling slightly faded away, not completely.
>>>> If not, what's the point in waiting with
>>>> waitformultiplemessages?
>>>
>>> WaitForMultipleOBJECTS, not messages!
>>> In my opinion the listener thread needs to be blocked while the client
>>> has no window (until the client has the new window allocated in the
>>> worker thread).
>>
>> So do you think this design is not mature?
>
> It is working reliable. Since there may be messages in the queue for
> the windowless client, my only idea was to block the listener thread.
> If there's a smarter/faster way please let us know.

I do not have a better alternative for v5 but v6 promises big. IF ONLY IT 
WORKED IN C++!

Thanks,

SZ

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

2006-03-22 Thread Arno Garrels
Fastream Technologies wrote:
> My puzzling slightly faded away, not completely.
>>> If not, what's the point in waiting with
>>> waitformultiplemessages?
>> 
>> WaitForMultipleOBJECTS, not messages!
>> In my opinion the listener thread needs to be blocked while the client
>> has no window (until the client has the new window allocated in the
>> worker thread).
> 
> So do you think this design is not mature?

It is working reliable. Since there may be messages in the queue for
the windowless client, my only idea was to block the listener thread.
If there's a smarter/faster way please let us know.

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


Re: [twsocket] WSocketTS

2006-03-22 Thread Fastream Technologies
- Original Message - 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Wednesday, March 22, 2006 6:16 PM
Subject: Re: [twsocket] WSocketTS


> Fastream Technologies wrote:
>
>> Now, does the end of this function (FOnClientAttached()) run in the 
>> worker
>> thread context?
>
> No
>
>> If not, what's the point in waiting with
>> waitformultiplemessages?
>
> WaitForMultipleOBJECTS, not messages!
> In my opinion the listener thread needs to be blocked while the client
> has no window (until the client has the new window allocated in the
> worker thread).

I cannot do this without modifying Francois' existing code and breaking 
compatibility. What about detroying the window in constructor? BTW, isn't 
this what ThreadDetach does?


>
> If you would post a message from the worker thread to the listener
> thread you would need to process messages in the listener thread
> in order to receive that message which would not block the listener
> thread.
>
> WaitForSingleObject would work also but is dangerous.
> - First object is an event handle signaled in the worker thread
> after the Client has called ThreadAttach.
> - Second object is the thread handle so if the thread thread
> terminates a new attempt is made to attach to another thread.

I tried this on the single connection per thread web server. Provided 700 
requests/sec but failed after a min (LOCKED UP).

Regards,

SZ

>
>
> ---
> Arno Garrels [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
>
>
>
>> Isn't only the PostThreadMessage enough?
>> Francois, could you enlight me? I am puzzled!
>>
>> Best Regards,
>>
>> SZ
> -- 
> 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] WSocketTS

2006-03-22 Thread Fastream Technologies
My puzzling slightly faded away, not completely.

- Original Message - 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Wednesday, March 22, 2006 6:16 PM
Subject: Re: [twsocket] WSocketTS


> Fastream Technologies wrote:
>
>> Now, does the end of this function (FOnClientAttached()) run in the 
>> worker
>> thread context?
>
> No
>
>> If not, what's the point in waiting with
>> waitformultiplemessages?
>
> WaitForMultipleOBJECTS, not messages!
> In my opinion the listener thread needs to be blocked while the client
> has no window (until the client has the new window allocated in the
> worker thread).

So do you think this design is not mature?

>
> If you would post a message from the worker thread to the listener
> thread you would need to process messages in the listener thread
> in order to receive that message which would not block the listener
> thread.

Sure.

>
> WaitForSingleObject would work also but is dangerous.
> - First object is an event handle signaled in the worker thread
> after the Client has called ThreadAttach.
> - Second object is the thread handle so if the thread thread
> terminates a new attempt is made to attach to another thread

I see.

>
>
> ---
> Arno Garrels [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
>
>
>
>> Isn't only the PostThreadMessage enough?
>> Francois, could you enlight me? I am puzzled!
>>
>> Best Regards,
>>
>> SZ
> -- 
> 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] WSocketTS

2006-03-22 Thread Arno Garrels
Fastream Technologies wrote:

> Now, does the end of this function (FOnClientAttached()) run in the worker
> thread context? 

No

> If not, what's the point in waiting with
> waitformultiplemessages? 

WaitForMultipleOBJECTS, not messages!
In my opinion the listener thread needs to be blocked while the client
has no window (until the client has the new window allocated in the
worker thread).

If you would post a message from the worker thread to the listener
thread you would need to process messages in the listener thread
in order to receive that message which would not block the listener
thread.

WaitForSingleObject would work also but is dangerous.
- First object is an event handle signaled in the worker thread
after the Client has called ThreadAttach.
- Second object is the thread handle so if the thread thread
terminates a new attempt is made to attach to another thread.


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

  

> Isn't only the PostThreadMessage enough?
> Francois, could you enlight me? I am puzzled!
> 
> Best Regards,
> 
> SZ
-- 
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