If the ClientSocket is closed, the callback for OnDataAvailable is
triggered and the missing Bytes are received.
This is the common sympton of missing line endings so the event is never
called. But this would not explain why it's suddenly happening.
I gave up on LineMode a long time ago, and
I had a similar problem when converting to XE2 from Delphi7 - my TwSocket
component was designed to send a header string containing the length of the
data to follow, and then I would read that bit to get the actual data - and
then process it - but with XE2 being unicode aware - suddenly I had
Hi All,
I have a udp client for the TFTP protocol that has worked perfectly
since I first wrote it in 1999.
Recently we upgraded to Delphi 2010 so I also upgraded to the V7 source
code.
Unfortunately, things no longer work.
I can send the initial request packet to the TFTP server (on the same
I have a udp client for the TFTP protocol that has worked perfectly
since I first wrote it in 1999.
Recently we upgraded to Delphi 2010 so I also upgraded to the V7
source code.
Unfortunately, things no longer work.
Source written 10 years ago will not be aware of Unicode and will
...@elists.org]
On Behalf Of Angus Robertson - Magenta Systems Ltd
Sent: Wednesday, February 17, 2010 10:23 AM
To: twsocket@elists.org
Subject: Re: [twsocket] OnDataAvailable event not firing for UDP client
I have a udp client for the TFTP protocol that has worked perfectly
since I first wrote
Jonathan.
- Original Message -
From: Francois PIETTE [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Wednesday, April 18, 2007 3:44 PM
Subject: Re: [twsocket] OnDataAvailable
I would like to know if this is normal to have the event
OnDataAvailable trigger and get
Hi,
I would like to know if this is normal to have the event OnDataAvailable
trigger and get a RcvdCount = 0 ?
I'm using tcp socket with twsocket. i'm on bcb 2006.
regards
Jonathan
--
To unsubscribe or change your settings for TWSocket mailing list
please goto
Hello Jonathan,
Yes RcvdCount is not reliable according to Microsoft. You should try to
receive anyway and check the returned Count value from the Receive
method.
---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz
Wednesday, April 18, 2007,
I would like to know if this is normal to have the event OnDataAvailable
trigger
and get a RcvdCount = 0 ?
Yes, it is normal. Some article in MSDN expalin that RcvdCount (at least the
API behind it) is not always reliable. The best strategy in your
OnDataAvailable even is to always call
I would like to know if this is normal to have the event
OnDataAvailable trigger and get a RcvdCount = 0 ?
0 length can happen, you must allow for it.
Be aware that having RcvdCount = 0 is a different issue than having Receive
returning 0.
Also -1 which means an error, which you can get
Markus Humm wrote:
I don't call processmessages and the like directly in the event but
might output some lines on screen for debugging.
How? ShowMessage is a modal form.
Other thing: what about critical sections. Would they be safe for
preventing this in my situation?
No, critical
of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be
- Original Message -
From: Markus Humm [EMAIL PROTECTED]
To: twsocket@elists.org
Sent: Friday, September 01, 2006 7:25 AM
Subject: [twsocket] OnDataAvailable and Reetrancy
Can OnDataAvailable be called while
But TWSocket will swallow the exception, so use this:
var
AFlag:Boolean
procedure TForm.WSocketDataAvailable(Sender: TObject; ErrCode: Word);
begin
try
if AFlag then
raise Exception.Create('reentered');
AFlag := TRUE;
try
[..]
finally
Hello,
I've a server and a client app. which communicate through a TCP based
protocoll I designed.
The server get's requests which in OnDataAvailable are received into a
1500 Byte sized array (most time the app. will run on a LAN) whose
contents is copied into a larger buffer then since the
: Thursday, August 31, 2006 8:20 PM
Subject: [twsocket] OnDataAvailable and reetrancy
Hello,
I've a server and a client app. which communicate through a TCP based
protocoll I designed.
The server get's requests which in OnDataAvailable are received into a
1500 Byte sized array (most time the app
Can OnDataAvailable be called while it is
already running?
And if yes, how to prevent this? Is using critical
sections a good idea here?
You must avoid having the events reentered. To avoid this, you simply
have
to _not_ call any form of the message pump from the events. The
message
Hello,
I'm still stuck with my problems :
http://groups.google.fr/group/borland.public.delphi.internet.winsock/browse_frm/thread/d1361882f2bf604a/a848b588964d09a2?lnk=stq=rnum=1hl=fr#a848b588964d09a2
F. Piette said to view example : there is bunch of example, the only one i
found is the
: [twsocket] Twsocket/onDataAvailable in a DLL, called by a Thread
Hello,
I'm still stuck with my problems :
http://groups.google.fr/group/borland.public.delphi.internet.winsock/browse_frm/thread/d1361882f2bf604a/a848b588964d09a2?lnk=stq=rnum=1hl=fr#a848b588964d09a2
F. Piette said to view
Hello,
TWSocket has a method 'MessageLoop'. You only have to call this one
because it is pumping messages until WM_QUIT is posted to it.
To execute TWSocket in thread context you have to do this in Execute
method of thread:
- Create it in Execute method of thread
- Assign properties and event
I find that calling pause in OnSessionConnected() is effective.
But calling pause in OnClientDataAvailable() does not work.
OnClientDataAvailable() keeps getting fired. Any ideas?
Maybe your socket already received data when you pause it.
Pause only affect winsock notification. It stops
Hello Francois,
I find that calling pause in OnSessionConnected() is effective.
But calling pause in OnClientDataAvailable() does not work.
OnClientDataAvailable() keeps getting fired. Any ideas?
--
Best regards,
Jack
Sunday, January 22, 2006, 10:33:21 AM, you wrote:
Maybe use Pause/Resume ?
Hello Dod,
Using line mode OFF, if I do for example a .Send of 500 bytes, the
receiver should get just one OnDataAvailable event.
Mostly, but not for sure. You can also receive more bytes if the sender
sends a second packet a little later. TCP does not respect packet
boundary.
If it will
Hello Dod,
Maybe another apprach is to use always a timeout and reset it every
time data is received. But then you have to send keep alive packets to
not get disconnected in case there is no real traffic needed.
---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
Hello Francois,
You can't ignore OnDataavailable event !
Got it.
There is a flag FPaused but it is not exposed as a property.
Oh, will you be able to expose it? I can modify the source
code for now but I think it's useful when Pause and Resume
is exposed.
Not really. You can have a
= 0.
--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be
- Original Message -
From: Jack [EMAIL PROTECTED]
To: twsocket@elists.org
Sent: Sunday, January 22, 2006 5:25 AM
Subject: [twsocket] OnDataAvailable called before
.
--
Contribute to the SSL Effort. Visit
http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be
- Original Message -
From: Jack [EMAIL PROTECTED]
To: twsocket@elists.org
Sent: Sunday, January 22, 2006 5:25 AM
Subject: [twsocket] OnDataAvailable called
Is there a way to tell the number of bytes available without
actually retrieving the data?
There is RcvdCount but due to winsock limitation, it is not always accurate.
At some point I'd like to know
if there is data available but do not want to actually remove
the data from twsocket's
Maybe use Pause/Resume ?
Oh, I didn't even know these two methods. So Pause will stop
all network connectivity on that socket until it's resumed?
It suppress async notification. So you don't receive events anymore but I/O
continue as much as winsock can, for example filling his receive
Hello Francois,
Maybe use Pause/Resume ?
It suppress async notification. So you don't receive events anymore but I/O
continue as much as winsock can, for example filling his receive buffer.
Got it. Wouldn't this be similar to ignoring OnDataAvailable event
and is vulnerable to DOS attack?
Hello Jack,
if there is data available but do not want to actually remove
the data from twsocket's buffer. This is because I want to
You can use Pauze / Resume but there is also a very simple way to do it,
just set wsoNoReceiveLoop in SocketOptions to True and dont Receive in
OnDataAvailable,
Hello Jack,
It suppress async notification. So you don't receive events anymore but I/O
continue as much as winsock can, for example filling his receive buffer.
Got it. Wouldn't this be similar to ignoring OnDataAvailable event
and is vulnerable to DOS attack?
If you call Pauze then winsock
Hello Francois and all,
I use telnet as client to connect to a twsocketserver,
after connecting to it, without sending any data from
the client (do not type anything in telnet) I call shutdown(1)
on all the client sockets. After this, although there is no
data received, the client socket's
I was wondering about something concerning the OnDataAvailable event for
Twsocket. If I assign a string to the receivestr function inside the
OnDataAvailable event and I have lengthy processing do i miss other
OnDataAvailable events and my string clears during the reassignment or is
the data
I was wondering about something concerning the OnDataAvailable event for
Twsocket. If I assign a string to the receivestr function inside the
OnDataAvailable event and I have lengthy processing do i miss other
OnDataAvailable events and my string clears during the reassignment or is
the data
34 matches
Mail list logo