Article View: borland.public.cppbuilder.internet.socket
Article #5389Re: TCP Client/Server comms using Indy 9
From: Alfred Thomas
Date: Tue, 31 Aug 2004 06:42
Date: Tue, 31 Aug 2004 06:42
32 lines
2206 bytes
2206 bytes
Hi Remy Thanks for your help. >>AnsiString Buffer = AThread->Connection->ReadLn(LF,IdTimeoutDefault, -1); Tried this instead of AThread->Connection->ReadLn(); The problem was that later in the program I used AThread->Connection->Write(...) instead of WriteLn(...) >Well, for one thing, your client is trying to read a string back from the >server, but your server code does not appear to ever actually send a string >back to the client at all. This is just a small piece of testing code - In the actual code, the AThread->Connection is copied to an object and later used to send back the response. >>Also, you have two other problems in your server >code - 1) you are catching all exceptions and then discarding them, so the >server will never know about socket errors that occur, and 2) you are using >ShowMessage(), which is not thread-safe. In the actual code I will have better exception handling than ShowMessage :) >Why not? Please be more specific. As I said I have used ReadLn() together with Write(). I have now changed the code as you suggested and it works perfectly. I had to convert an existing project from TClient and TServer sockets to Indy socket because I needed to use Https components. I really appreciate your help Regards Alfred
Technical Details
Message-ID:
<41341dd3$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4132e67f$1@newsgroups.borland.com> <413360a6$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,342abc5fb29e757e X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Alfred Thomas" <alfred@fischerint.co.za> Sender: "Alfred Thomas" <alfred@fischerint.co.za> Reply-To: "Alfred Thomas" <alfred@fischerint.co.za> Subject: Re: TCP Client/Server comms using Indy 9 Newsgroups: borland.public.cppbuilder.internet.socket X-User-Info: 196.25.217.126 X-Forwarded-For: 192.96.150.59 References: <4132e67f$1@newsgroups.borland.com> <413360a6$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <41341dd3$1@newsgroups.borland.com> Date: 30 Aug 2004 23:42:27 -0700 X-Trace: newsgroups.borland.com 1093934547 207.105.83.66 (30 Aug 2004 23:42:27 -0700) Lines: 32 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail