Article View: borland.public.cppbuilder.internet.socket
Article #5254Re: TClientSocket/TServerSocket data exchange...
From: Hans Galema
Date: Mon, 27 Sep 2004 19:53
Date: Mon, 27 Sep 2004 19:53
49 lines
2237 bytes
2237 bytes
Vladimir Stefanovic wrote: > I want my Client to send a request to Server to get > some file. Imaginary protocol: > > GET filename.txt Allow rigth for binary files too: GET filename.pdf > Then, I want the Server to receive the request and to > send back the Client the desired file contents. Imaginary > protocol: > > FIL this_is_the_pure_ascii_contents_of_the_filename.txt Better: size FIL this_is_the_pure_contents_of_filename.doc or FIL size this_is_the_pure_contents_of_the_filename.doc The last will do if the client only expects 3 char commands. > The Server receives data through it's own thread > stThreadBlocking & ServerSocketGetThread(). > > How I'm supposed to SEND BACK the Client the desired > file? Where I have to place the sending code? Should I > have the alternative TClientSocket on Server to use for > sending? There are some examples of how to send a row > of text back ( SendText() ) but my file can be several KB > so I cannot send the file back from only one pass... Nothing of that all. You got data from a client using something like pStream->Read() in your Threads Execute() method. In the same method you can use pStream->Write() to send data to the client. Hans.
Technical Details
Message-ID:
<41586f09@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!t-online.de!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<41585538@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,20726cd0f74fe942 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 27 Sep 2004 21:53:51 +0200 From: Hans Galema <dontusethis@dontusethis.nl> User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: TClientSocket/TServerSocket data exchange... References: <41585538@newsgroups.borland.com> In-Reply-To: <41585538@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 129.125.201.248 Message-ID: <41586f09@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1096314633 129.125.201.248 (27 Sep 2004 12:50:33 -0700) Lines: 49 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!t-online.de!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail