Re: [twsocket] Faststream FTP server

2007-12-06 Thread Fastream Technologies
Hello,

Fixed the bug in my copy. Thanks,

SZ


On Thu, 6 Dec 2007 20:04 + (GMT Standard Time), Angus Robertson -
Magenta Systems Ltd <[EMAIL PROTECTED]> wrote:
>
> If the Faststream FTP server uses the ICS FTP component, why does the
> MLST command return a zero file size and . instead of the name for a file
> that exists, and fails to calculate an MD5Sum?
>
> > MLST client-toolkit-4.11.8-windows.jar
> <
> size=0;type=file;perm=fdrwa;create=20051108192400;modify=20071206190453;
> .
> < 250 END
> > PORT 192,168,1,119,12,19
> < 200 Port command successful.
> > RETR client-toolkit-4.11.8-windows.jar
> < 150 Opening data connection for client-toolkit-4.11.8-windows.jar.
> ! Download size, compressed 12.3Mbytes, uncompressed 12.3Mbytes
> < 226 File sent ok
> ! 12.3Mbytes received/sent in 11 seconds (1.08Mbytes/sec)
> Downloaded File d:\tempfiles\client-toolkit-4_11_8-windows_jar.tmp, Size
> 12,881,438
> > MD5 client-toolkit-4.11.8-windows.jar
> < 504 Bad file name or not indexed.
>
> Angus
>
-- 
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] Faststream FTP server

2007-12-06 Thread Fastream Technologies
Hello,

Firstly, it is "Fastream" not "faststream". Second, we will investigate the
issue tomorrow. The probable reason would be we use a custom unit since we
need to support multi-cores/threads. WE also must support deep user
permission settings (See "perm=fdrwa;").

Thanks a lot for the report,

SubZ

On Thu, 6 Dec 2007 20:04 + (GMT Standard Time), Angus Robertson -
Magenta Systems Ltd <[EMAIL PROTECTED]> wrote:
>
> If the Faststream FTP server uses the ICS FTP component, why does the
> MLST command return a zero file size and . instead of the name for a file
> that exists, and fails to calculate an MD5Sum?
>
> > MLST client-toolkit-4.11.8-windows.jar
> <
> size=0;type=file;perm=fdrwa;create=20051108192400;modify=20071206190453;
> .
> < 250 END
> > PORT 192,168,1,119,12,19
> < 200 Port command successful.
> > RETR client-toolkit-4.11.8-windows.jar
> < 150 Opening data connection for client-toolkit-4.11.8-windows.jar.
> ! Download size, compressed 12.3Mbytes, uncompressed 12.3Mbytes
> < 226 File sent ok
> ! 12.3Mbytes received/sent in 11 seconds (1.08Mbytes/sec)
> Downloaded File d:\tempfiles\client-toolkit-4_11_8-windows_jar.tmp, Size
> 12,881,438
> > MD5 client-toolkit-4.11.8-windows.jar
> < 504 Bad file name or not indexed.
>
> Angus
> --
> 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] Faststream FTP server

2007-12-06 Thread Angus Robertson - Magenta Systems Ltd
If the Faststream FTP server uses the ICS FTP component, why does the
MLST command return a zero file size and . instead of the name for a file
that exists, and fails to calculate an MD5Sum?

> MLST client-toolkit-4.11.8-windows.jar
<
size=0;type=file;perm=fdrwa;create=20051108192400;modify=20071206190453;
.
< 250 END
> PORT 192,168,1,119,12,19
< 200 Port command successful.
> RETR client-toolkit-4.11.8-windows.jar
< 150 Opening data connection for client-toolkit-4.11.8-windows.jar.
! Download size, compressed 12.3Mbytes, uncompressed 12.3Mbytes
< 226 File sent ok
! 12.3Mbytes received/sent in 11 seconds (1.08Mbytes/sec)
Downloaded File d:\tempfiles\client-toolkit-4_11_8-windows_jar.tmp, Size
12,881,438
> MD5 client-toolkit-4.11.8-windows.jar
< 504 Bad file name or not indexed.

Angus
-- 
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] ASyncReceive and wsoNoReceiveLoop

2007-12-06 Thread Arno Garrels
Jake Traynham wrote:
> Wilfried,
> 
>> 
>>> 3. Put a loop in my DataAvailable event that will do a Receive
>>> until I get -1 back.  This would probably be the easiest to
>>> implement for me. 
>> 
>> No never do that. Don't set wsoReceiveLoop. If something is still (or
>> again) in receiving winsock buffer when you leave OnDataAvailable
>> then it will trigger again in a loop.
>> 
> 
>If I don't set wsoNoReceiveLoop, then AsyncReceive loops
> continually calling my OnDataAvailable event.  This would be fine if
> winsock did not put more FD_Read messages in the queue when I don't
> receive all the data.  The problem I'm facing is that on very large
> transfers, winsock is flooding the queue with these FD_Read messages
> which produce extra and pointless calls to OnDataAvailable.  This is
> what I'm trying to correct. 
> 
>So, the way I see it, I either have to set wsoNoReceiveLoop and let
> each FD_Read message produce a single call to my OnDataAvailable
> event, or I need to let AsyncRecieve loop and somehow tell winsock to
> not produce the extra FD_Read messages.  What produces the fastest
> transfers and how would I set it up?

Maybe the following is a hint: 
"with either recv/WSARecv(..., MSG_PEEK) or ioctlsocket(FIONREAD, ...), 
to obtain the amount of data in the receive buffer is highly inefficient
because the system must lock the data and count it."
(http://support.microsoft.com/kb/192599/en)


> 
>>> All in all, speed is my main interest here.  I want to read in all
>>> the data the server is sending me as fast as possible.
>> 
>> - if possible move the data direcly where it belong, not copy it
>> first in   a buffer as you do now. If you have to buffer it in
>> between for some   reason make it as large as possible (make a
>> little test case to see   how large receiving packets will be in a
>> real world test). - if you move direcly where it belong then you
>> have to receive only what   you need of course. but no worry
>> OnDataAvailable will trigger again   immediatly.
> 
>I think you misunderstand me.  My OnDataAvailable event is calling
> Receive to read in the data and then that data is processed.  The only
> way I can process it is to read it in.  I'm not saving this data to a
> file on the hard drive or anything.  So, I don't know what you mean by
> "move the data directly where it belongs".

I think Wilfried ment that frequent memory allocation/deallocation and
moving data around in memory is slow. 

--
Arno Garrels
 

> 
> 
> --
> Jake Traynham
> Owner, CNS Plug-ins
> http://www.cnsplug-ins.com/
-- 
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] AV in TWSocketThrdServer.PutDataInSendBuffer

2007-12-06 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
>  Quote from Arno:
> csDestroying is already in the states when you call
> DisconnectAll() from the destructor of the server's
> owner component.
> If you created the server with a nil owner, no problemo.
> -
> 
> Then, as you say, there's no problemo, because that's
> exactly what I do. :)
> 
> So, to make sure I understand:  If I call
> DisconnectAll() before destroying the server
> component, I still need to wait and process messages
> to make sure all clients are disconnected *before*
> calling the server's destructor, or else it may never
> fire OnSessionClose() on them once it starts
> destroying, right?

Yes, that should work. 

Arno 

> 
>-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] AV in TWSocketThrdServer.PutDataInSendBuffer

2007-12-06 Thread [EMAIL PROTECTED]
 Quote from Arno:
csDestroying is already in the states when you call
DisconnectAll() from the destructor of the server's
owner component.
If you created the server with a nil owner, no problemo. 
-

Then, as you say, there's no problemo, because that's
exactly what I do. :)

So, to make sure I understand:  If I call
DisconnectAll() before destroying the server
component, I still need to wait and process messages
to make sure all clients are disconnected *before*
calling the server's destructor, or else it may never
fire OnSessionClose() on them once it starts
destroying, right?

   -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] AV in TWSocketThrdServer.PutDataInSendBuffer

2007-12-06 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
>  Quote from Arno:
> I guess it's worth a trial to simply ThreadAttach all
> clients in
> the destructor after all threads terminated.
> ..
> 
> 
> I'm sorry, I don't mean to be obtuse, but what would
> that do?

That creates a new hidden window in the new, current thread
context. The old window in worker thread context has been
destroyed when the worker threads terminated, so message
handling will work again. Note that OnClientDisconnect
does not fire when clients are disconnected from the
destructor, that's the same behaviour as in TWSocketServer
as well.  

> 
> I was thinking I could call DisconnectAll() before
> calling the destructor of the thrdserver... 

You need to wait and process messages until all
clients are actually closed, that is when ClientCount 
becomes 0. Clients are removed from the client list when 
SessionClosed/ClientDisconnect fires. 
But... if csDestroying is in the component states it won't 
never fire.
csDestroying is already in the states when you call 
DisconnectAll() from the destructor of the server's owner component.
If you created the server with a nil owner, no problemo. 

--
Arno Garrels


> 
>-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] ASyncReceive and wsoNoReceiveLoop

2007-12-06 Thread Jake Traynham
Wilfried,

> 
>> 3. Put a loop in my DataAvailable event that will do a Receive until I
>> get -1 back.  This would probably be the easiest to implement for me.
> 
> No never do that. Don't set wsoReceiveLoop. If something is still (or
> again) in receiving winsock buffer when you leave OnDataAvailable then
> it will trigger again in a loop.
> 

   If I don't set wsoNoReceiveLoop, then AsyncReceive loops continually 
calling my OnDataAvailable event.  This would be fine if winsock did not 
put more FD_Read messages in the queue when I don't receive all the 
data.  The problem I'm facing is that on very large transfers, winsock 
is flooding the queue with these FD_Read messages which produce extra 
and pointless calls to OnDataAvailable.  This is what I'm trying to correct.

   So, the way I see it, I either have to set wsoNoReceiveLoop and let 
each FD_Read message produce a single call to my OnDataAvailable event, 
or I need to let AsyncRecieve loop and somehow tell winsock to not 
produce the extra FD_Read messages.  What produces the fastest transfers 
and how would I set it up?

>> All in all, speed is my main interest here.  I want to read in all the
>> data the server is sending me as fast as possible.
> 
> - if possible move the data direcly where it belong, not copy it first in
>   a buffer as you do now. If you have to buffer it in between for some
>   reason make it as large as possible (make a little test case to see
>   how large receiving packets will be in a real world test).
> - if you move direcly where it belong then you have to receive only what
>   you need of course. but no worry OnDataAvailable will trigger again
>   immediatly.

   I think you misunderstand me.  My OnDataAvailable event is calling 
Receive to read in the data and then that data is processed.  The only 
way I can process it is to read it in.  I'm not saving this data to a 
file on the hard drive or anything.  So, I don't know what you mean by 
"move the data directly where it belongs".

Thanks,
Jake


-- 
Jake Traynham
Owner, CNS Plug-ins
http://www.cnsplug-ins.com/
-- 
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] AV in TWSocketThrdServer.PutDataInSendBuffer

2007-12-06 Thread [EMAIL PROTECTED]

 Quote from Arno:
Not in my sources. It posts a message to tell the
threads that they
shall terminate. When a thread terminates clients are
just ThreadDetached.


Yes, you are right, sorry.

 Quote from Arno:
I guess it's worth a trial to simply ThreadAttach all
clients in
the destructor after all threads terminated.
..


I'm sorry, I don't mean to be obtuse, but what would
that do?

I was thinking I could call DisconnectAll() before
calling the destructor of the thrdserver... would
that help?

   -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] Winsock-Error 'Invalid Parameter' (10022) under Win98

2007-12-06 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
> Hello Arno Garrels,
> thank you for your prompt answer.
> 
> The exception 'WSAAsyncSelect 10022 Invalid Argument' is fired at the
> line below: 
> 
> procedure TCustomWSocket.Connect;
> ...
> FSelectEvent := FD_READ   or FD_WRITE or FD_CLOSE or
> FD_ACCEPT or FD_CONNECT;
> iStatus   :=
> WSocket_Synchronized_WSAASyncSelect(FHSocket,Handle,WM_ASYNCSELECT,
> FSelectEvent);  
> 
> --
> ==>> The return value of iStatus is -1 and so => Exit
> --
> 
> if iStatus <> 0 then begin
> SocketError('WSAAsyncSelect');
> Exit;
> end;
> ...
> 
> There is no effect removing 'FD_ACCEPT' at line:
> FSelectEvent:=FD_READ or FD_WRITE or FD_CLOSE or FD_ACCEPT or
> FD_CONNECT;

After removing 'FD_ACCEPT', are you sure that you rebuilt all?
Otherwise changes may not have been compiled. If that doesn't
help I don't know what's wrong. Possibly a reinstall of the 
network stuff helps?

--
Arno Garrels

 
> 
> 
> Thanks and Regards
> Hans
> 
> 
> 
> 
>  Original-Nachricht 
>> Datum: Wed, 5 Dec 2007 15:39:23 +0100
>> Von: "Arno Garrels" <[EMAIL PROTECTED]>
>> An: "ICS support mailing" 
>> Betreff: Re: [twsocket] Winsock-Error \'Invalid Parameter\' (10022)
>> under Win98  [EMAIL PROTECTED] wrote:
>>> Hello
>>> 
>>> I'm using the ICS and Delphi 4 to test the mail-send demo on an
>>> system with Win98SE. When attempting to connect to the mailserver it
>>> throws the winsock error 'Invalid Parameter' (10022). Causing this
>>> the version of the winsock-dll? Installed: ws2_32.dll / 4.10.
>>> 
>>> On an XP-system it works fine.
>>> 
>>> Any ideas to solve that problem ? (Not changing the System ;-))
>> 
>> Try to set a breakpoint in WSocket.pas,
>> procedure TCustomWSocket.Connect and single step thru the code.
>> Then please post the line where the exception is fired.
>> 
>> BTW: What happens if you remove FD_ACCEPT from FSelectEvent below?
>> I'm sure this has been removed some months before but now it's back
>> in my V6-version again, is it a regression?
>> 
>> FSelectEvent := FD_READ   or FD_WRITE or FD_CLOSE or
>> FD_ACCEPT or FD_CONNECT;
>> iStatus  := WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle,
>>
>> FMsg_WM_ASYNCSELECT,
>> FSelectEvent); 
>> 
>> --
>> Arno Garrels [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> 
>> 
>> 
>> 
>> --
>> 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
> 
> --
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
-- 
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] AV in TWSocketThrdServer.PutDataInSendBuffer

2007-12-06 Thread Arno Garrels
DZ-Jay wrote:
> On Dec 6, 2007, at 05:39, Arno Garrels wrote:
> 
>> I think it helps to disconnect all, then destroy the server
>> object after all clients have been actually disconnected.
> 
> I'll look into this, but as far as I recall (I have no access to the
> source code right now), the TWSocketThrdServer destructor calls
> DisconnectAll which does this. 

Not in my sources. It posts a message to tell the threads that they
shall terminate. When a thread terminates clients are just ThreadDetached.

> And (as I seem to recall also), it
> uses WaitForMultipleObjects() until the clients notify that they have
> finished and frees them.

It waits until all worker threads are finished thus all client's 
HWND is 0, that may cause the problem.
 
> What I'm saying is that I was under the impression that the server
> class was handling the disconnection of all clients when destroyed. 
> If this is not true, then I can build it into my application, no
> problem; but if it is true, then that means there may be something
> wrong in the code. 

The problem is that TriggerSessionClosed won't be called when you
disconnect a client from server's destructor or from a destructor of 
its owner since csDestroying would be in component states
(see InternalClose).

I guess it's worth a trial to simply ThreadAttach all clients in
the destructor after all threads terminated.
..
until FThreadList.Count = 0;
==>for I := ClientCount -1 downto 0 do
==>Client[I].ThreadAttach;

--
Arno Garrels


I'll see what I can find when I get to the office
> later on. 
> 
> dZ.
> 
> --
> DZ-Jay [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
-- 
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] Winsock-Error 'Invalid Parameter' (10022) under Win98

2007-12-06 Thread aramax
Hello Arno Garrels,
thank you for your prompt answer.

The exception 'WSAAsyncSelect 10022 Invalid Argument' is fired at the line 
below:

procedure TCustomWSocket.Connect;
...
FSelectEvent := FD_READ   or FD_WRITE or FD_CLOSE or
FD_ACCEPT or FD_CONNECT;
iStatus   := 
WSocket_Synchronized_WSAASyncSelect(FHSocket,Handle,WM_ASYNCSELECT, 
FSelectEvent);

--
==>> The return value of iStatus is -1 and so => Exit
--

if iStatus <> 0 then begin
SocketError('WSAAsyncSelect');
Exit;
end;
...

There is no effect removing 'FD_ACCEPT' at line:
FSelectEvent:=FD_READ or FD_WRITE or FD_CLOSE or FD_ACCEPT or FD_CONNECT;


Thanks and Regards
Hans




 Original-Nachricht 
> Datum: Wed, 5 Dec 2007 15:39:23 +0100
> Von: "Arno Garrels" <[EMAIL PROTECTED]>
> An: "ICS support mailing" 
> Betreff: Re: [twsocket] Winsock-Error \'Invalid Parameter\' (10022) under 
> Win98

> [EMAIL PROTECTED] wrote:
> > Hello
> > 
> > I'm using the ICS and Delphi 4 to test the mail-send demo on an
> > system with Win98SE. When attempting to connect to the mailserver it
> > throws the winsock error 'Invalid Parameter' (10022). Causing this
> > the version of the winsock-dll? Installed: ws2_32.dll / 4.10.
> > 
> > On an XP-system it works fine.
> > 
> > Any ideas to solve that problem ? (Not changing the System ;-))
> 
> Try to set a breakpoint in WSocket.pas, 
> procedure TCustomWSocket.Connect and single step thru the code.
> Then please post the line where the exception is fired.
> 
> BTW: What happens if you remove FD_ACCEPT from FSelectEvent below?
> I'm sure this has been removed some months before but now it's back
> in my V6-version again, is it a regression?  
> 
> FSelectEvent := FD_READ   or FD_WRITE or FD_CLOSE or
> FD_ACCEPT or FD_CONNECT;
> iStatus  := WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle,
> FMsg_WM_ASYNCSELECT,
> FSelectEvent);
> 
> --
> Arno Garrels [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
> 
> 
> 
> 
> -- 
> 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

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
-- 
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] AV in TWSocketThrdServer.PutDataInSendBuffer

2007-12-06 Thread DZ-Jay

On Dec 6, 2007, at 05:39, Arno Garrels wrote:

> I think it helps to disconnect all, then destroy the server
> object after all clients have been actually disconnected.

I'll look into this, but as far as I recall (I have no access to the 
source code right now), the TWSocketThrdServer destructor calls 
DisconnectAll which does this.  And (as I seem to recall also), it uses 
WaitForMultipleObjects() until the clients notify that they have 
finished and frees them.

What I'm saying is that I was under the impression that the server 
class was handling the disconnection of all clients when destroyed.  If 
this is not true, then I can build it into my application, no problem; 
but if it is true, then that means there may be something wrong in the 
code.  I'll see what I can find when I get to the office later on.

dZ.

-- 
DZ-Jay [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

-- 
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] AV in TWSocketThrdServer.PutDataInSendBuffer

2007-12-06 Thread DZ-Jay

On Dec 6, 2007, at 05:29, Francois Piette wrote:

> Make sure all connections are closed/aborted before freeing the server
> object.

According to the TWSocketThrdServer code, this is what it does in its 
destructor...

> And as usual, at the application level don't store a reference to a
> connection object because that reference may become invalid when the 
> object
> is freed.

I don't.

> If you need to store a reference somewhere, then you must code a
> notification mechanism, probably from the destructor of your client 
> class.

Yes.

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] AV in TWSocketThrdServer.PutDataInSendBuffer

2007-12-06 Thread Arno Garrels
DZ-Jay wrote:
> On Dec 6, 2007, at 04:28, Francois Piette wrote:
> 
>> For some reason, you call PutDataInSendBuffer after it has already
>> been freed.
> 
> After the object was freed, or the buffer was freed?  

The buffer is freed in the destructor of TCustomWSocket.

> Keep in mind
> that I just called WSocketThrdServer.Free, so it was problably
> destroying the object while it was attempting to send...?  
> If so, how
> can I prevent this?

I think it helps to disconnect all, then destroy the server 
object after all clients have been actually disconnected.

--
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] AV in TWSocketThrdServer.PutDataInSendBuffer

2007-12-06 Thread Francois Piette
> > For some reason, you call PutDataInSendBuffer after it has already been
> > freed.
>
> After the object was freed, or the buffer was freed?  Keep in mind that
> I just called WSocketThrdServer.Free, so it was problably destroying
> the object while it was attempting to send...?

I think freeing the server object will free all connection objects which
each will free the buflist.

> If so, how can I prevent this?

Make sure all connections are closed/aborted before freeing the server
object.
And as usual, at the application level don't store a reference to a
connection object because that reference may become invalid when the object
is freed.
If you need to store a reference somewhere, then you must code a
notification mechanism, probably from the destructor of your client class.

--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
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] 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] AV in TWSocketThrdServer.PutDataInSendBuffer

2007-12-06 Thread DZ-Jay

On Dec 6, 2007, at 04:28, Francois Piette wrote:

> For some reason, you call PutDataInSendBuffer after it has already been
> freed.

After the object was freed, or the buffer was freed?  Keep in mind that 
I just called WSocketThrdServer.Free, so it was problably destroying 
the object while it was attempting to send...?  If so, how can I 
prevent this?

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] AV in TWSocketThrdServer.PutDataInSendBuffer

2007-12-06 Thread Francois Piette
>The full error is "[EAccessViolation] Access
> violation at address 00469094 in module
> 'SmailQ_con.exe'. Read of address 0008"
> {  THE FOLLOWING LINE  }
> if FBufList.Count = 0 then begin

It is likely that FBufList is already freed and nilled when the line is
executed. I'm almost sure Count member is at offset 8 in the class instance.

For some reason, you call PutDataInSendBuffer after it has already been
freed.
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be



- Original Message - 
From: <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, December 05, 2007 10:24 PM
Subject: [twsocket] AV in TWSocketThrdServer.PutDataInSendBuffer


> Hello:
> I was testing my application and and noticed in
> the log that when I tried to destroy the
> TWSocketThrdServer while it had opened connections, I
> got a few (seemingly) random AVs which I traced to
> the following lines in PutDataInSendBuffer method:
>
> procedure TCustomWSocket.PutDataInSendBuffer(Data :
> Pointer; Len : Integer);
> var
>   oBuffer  : TBuffer;
>   cWritten : Integer;
>   bMore  : Boolean;
> begin
>   if (Len <= 0) or (Data = nil) then
> exit;
>
> {$IFDEF COMPILER2_UP}
>   EnterCriticalSection(GSendBufCritSect);
>   try
> {$ENDIF}
> {  THE FOLLOWING LINE  }
> if FBufList.Count = 0 then begin
>   oBuffer := TBuffer.Create(FBufSize);
>   FBufList.Add(oBuffer);
> end
> else
>   oBuffer := FBufList.Last;
> Inc(FBufferedByteCount, Len);
> bMore := TRUE;
> while bMore do begin
>   cWritten := oBuffer.Write(Data, Len);
>   if cWritten >= Len then
> bMore := FALSE
>   else begin
> Len  := Len - cWritten;
> Data := PChar(Data) + cWritten;
> if Len < 0 then
>   bMore := FALSE
> else begin
>   oBuffer := TBuffer.Create(FBufSize);
>   FBufList.Add(oBuffer);
> end;
>   end;
> end;
> bAllSent := FALSE;
> {$IFDEF COMPILER2_UP}
>   finally
> LeaveCriticalSection(GSendBufCritSect);
>   end;
> {$ENDIF}
> end;
>
>
>The full error is "[EAccessViolation] Access
> violation at address 00469094 in module
> 'SmailQ_con.exe'. Read of address 0008"
>
>Its hard for me to reproduce exactly, but has
> anybody any idea what could be causing this?
>
>-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

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