Article View: borland.public.cppbuilder.internet.socket
Article #4411Re: Indy TCP client conncted ?
From: Roberto Zais
Date: Thu, 24 Feb 2005 21:54
Date: Thu, 24 Feb 2005 21:54
59 lines
2928 bytes
2928 bytes
Perhaps in the example you provided is transmitted first of all an int that
means Number of following bytes
Sorry, but maybe .. I realize now. ReadInteger(true) reads the first (8?)
bytes of my proprietary protocol :-)
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 .
These peripherals are contacted using a Wlan : I must only open a connection
on port 8023 with a single node , and then I send and receive.
I have experimented that the following solution seems working : is it
correct?
(ReadFromStack provides the number of bytes actually available)
int size = TCPClient->ReadFromStack(true,2000,true);//ReadInteger(true);
if( size > 0 )
{
char *buf = new char[size];
TCPClient->ReadBuffer(buf, size);
// use buffer as needed...
delete[] buf;
return;
}
Please, can you give me another advice ..
(1) if(TCPClient->Connected()) //esito == true )
does not work : is there another way to test the connection?
which type of approach is best with Indy TCPClient ??
Shall I use a test like (1) or simply trap exceptions across every call
following the Connect() ?
Thank you a lot
Roberto
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> ha scritto nel messaggio
news:421ccc59$1@newsgroups.borland.com...
>
> "Roberto Zais" <rzaiss@tiscali.it> wrote in message
> news:421c62ea$1@newsgroups.borland.com...
>
> > more: I actually use for reading :
> <snip>
> > because
> > int size = TCPClient->ReadInteger(true);
> > returns a bad 7-digit number...
>
> Please provide more details. Did the server even send an integer to begin
> with? Did you write the server yourself, or at least have access to its
> source code? If so, then what does the server's sending code actually
look
> like?
>
>
> Gambit
>
>
Technical Details
Message-ID:
<421e4d30@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed.freenet.de!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>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,e9928c88cb4b1587 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Roberto Zais" <rzaiss@tiscali.it> 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> Subject: Re: Indy TCP client conncted ? Date: Thu, 24 Feb 2005 22:54:47 +0100 Lines: 61 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 212.171.9.148 Message-ID: <421e4d30@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1109282096 212.171.9.148 (24 Feb 2005 13:54:56 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail