Article View: borland.public.cppbuilder.internet.socket
Article #4412Re: Indy TCP client conncted ?
From: Remy Lebeau (TeamB)
Date: Thu, 24 Feb 2005 23:25
Date: Thu, 24 Feb 2005 23:25
45 lines
2658 bytes
2658 bytes
"Roberto Zais" <rzaiss@tiscali.it> wrote in message news:421e4d30@newsgroups.borland.com... > Perhaps in the example you provided is transmitted first of > all an int that means Number of following bytes That is the general assumption. > Sorry, but maybe .. I realize now. ReadInteger(true) reads > the first (8?) bytes of my proprietary protocol :-) ReadInteger() reads 4 bytes, not 8. An Integer is 4 bytes in size. > Concerning the details : my connection is with a remote peer directly > interfaced to a serial line , it is a direct tunnelling and > I speak using my own protocol . Then I suggest that your do transmit an Integer specifying the number of bytes to follow. > I have experimented that the following solution seems working : > is it correct? (ReadFromStack provides the number of bytes > actually available) Yes, it does specify the number of bytes actually read, but it doesn't tell you how many individual packets are in that data. Using the preceeding-int approach, you can read each packet individually, or read a larger block and then determine how many complete packets are contained in that block. > Please, can you give me another advice .. > (1) if(TCPClient->Connected()) //esito == true ) > does not work Yes, it does work. Why do you think that it does not. > Shall I use a test like (1) or simply trap exceptions across > every call following the Connect() ? Connect() does throw an exception if the connection fails, so checking Connected() after calling Connect() is redundant, but will still work anyway. Gambit
Technical Details
Message-ID:
<421e6284$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4219e6b2$1@newsgroups.borland.com> <421b7ed0$1@newsgroups.borland.com> <421c62ea$1@newsgroups.borland.com> <421ccc59$1@newsgroups.borland.com> <421e4d30@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,e9928c88cb4b1587 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <4219e6b2$1@newsgroups.borland.com> <421b7ed0$1@newsgroups.borland.com> <421c62ea$1@newsgroups.borland.com> <421ccc59$1@newsgroups.borland.com> <421e4d30@newsgroups.borland.com> Subject: Re: Indy TCP client conncted ? Date: Thu, 24 Feb 2005 15:25:57 -0800 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <421e6284$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1109287556 68.69.17.41 (24 Feb 2005 15:25:56 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail