Re:count streamed bytes from an http server
[This followup was posted to borland.public.delphi.internet.winsock and a
copy was sent to the cited author.]
In article <3BEE0C9E.8050...@mitty.com>, w...@mitty.com says...
Quote
> Don Siders - Team Indy wrote:
> > Are you using TCP or UDP for stream transmission?
> The client applet is using http get (and starts downloading the sound
> file), so that would be TCP, right?
Yes, it would be TCP.
Quote
> I'm a bit new to the "nitty gritty" of Internet protocols.
Try looking at Kudzu's article "Introduction to sockets". The URL is:
http://www.pbe.com/Kudzu/Articles/IntroToSockets/ .
Quote
> > TCP will get an OnWork event when buffers are read from the connection. UDP should have some type of marker in the stream to identify the current buffer
> > segment.
> How would I hook into that? I wouldn't know how to track that using the
> IdHTTPServer component.
Okay. Every connection to the server is in a thread (TIdPeerThread).
TIdPeerThread has a property called Connection which is a
TIdTCPServerConnection. This is a direct anscestor of TIdTCPConnection
(another anscestor is TIdTCPClient). The Connection object just like the
clients have an OnWork event. You can set event handlers in the
TIdTCPServer.OnConnect event for the thread's Connection object. One
thing to be careful about is that your event tracking code must be 100%
thread safe because it will be running in the context of the peer
connection thread and not the main-VCL thread.
--
Support the anti-Spam amendment - Join at http://www.cauce.org/
J. Peter Mugaas E-Mail: oma00...@mail.wvnet.edu
http://wvnvm.wvnet.edu/~oma00215/ ICQ Number: 14297043
Finger for PGP Key