Article View: borland.public.cppbuilder.internet.socket
Article #3175Re: TServerSocket Not Receiving Data
From: Bill Cain
Date: Tue, 15 Nov 2005 19:47
Date: Tue, 15 Nov 2005 19:47
87 lines
4164 bytes
4164 bytes
Thanks Remy for your response to Hans. Your conclusions and assumptions about what I am doing is correct. But I have some additional questions. Please see them below. Remy Lebeau (TeamB) wrote: > "Hans Galema" <notused@notused.nl> wrote in message > news:43790e73$1@newsgroups.borland.com... > > >>Do you use TClientSocket for the client part ? > > > That should not matter. TServerSocket can accept, and communicate with, any > client socket regardless of the environment it is coming from. Everything > ultmately operates on the same socket API anyway. TCP, and thus socket > behavior, is standardized across multiple platforms. > > >>Sorry. Servers do not connect to clients. A server can only >>listen and wait for connections. > > > In Bill's particular case, he is making his FTP client application open a > separate listening server socket that the FTP server application will > connect its own client socket to. That is one scenerio in how the FTP > protocol handles data connections. > > >>The OnRead event will never be triggered with stThreadBlocking. > > > That is correct only if Bill is not using the TServerSocket's OnGetThread > event to provide his own cutom thread object for TServerSocket to use for > each connection. The default thread object that TServerSocket created by > default does trigger the OnRead (and OnWrite) event. I am not using the TServerSocket's OnGetThread event to provide my own custom thread object. The statement above seems to be a contradiction. OnClientRead won't trigger if I don't use OnGetThread(that is if I use the default thread provided by TServerSocket), but then you say that the default thread does trigger OnRead. In my case the OnClientRead is not being triggered. Should it be? Also I have discovered that I can read data from the socket in the OnClientConnect event and I can use the ReceiveLength() method the see how much data is available if any (although I have read that the value may not be accurate). How can I determine if the data transfer is complete? I want to check my understanding here. It is my understanding that since my FTP client is executing in a thread other than the main VCL thread, that I must use stThreadBlocking mode since the thread does not have a message loop/service to trigger serial async events. Is that correct? > > >>You have to actively read from a stream. > > > That is not always the case. > > >>Is DataSocket2 a TServerSocket ? > > > Given the example FTP commands that Bill showed, then his DataSocket would > have to be a server socket, since that is what the PORT command requires. > > >>If yes why do you need 2 ? > > > He is only using 1 server socket. He has to be sending his FTP commands > over a client socket. > > >>We cannot check here the contents of Addr. > > > Presumably, Addr has been assigned to the IP that his TServerSocket is > listening on. > > > Gambit > >
Technical Details
Message-ID:
<437a3b0b$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4378d734$1@newsgroups.borland.com> <43790e73$1@newsgroups.borland.com> <43792aca$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,ed98f643ba2c61e4 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 15 Nov 2005 11:47:09 -0800 From: Bill Cain <bill.ctr.cain@faa.gov> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: TServerSocket Not Receiving Data References: <4378d734$1@newsgroups.borland.com> <43790e73$1@newsgroups.borland.com> <43792aca$1@newsgroups.borland.com> In-Reply-To: <43792aca$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 199.46.253.82 Message-ID: <437a3b0b$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1132083979 199.46.253.82 (15 Nov 2005 11:46:19 -0700) Lines: 87 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail