Article View: borland.public.cppbuilder.internet.socket
Article #3256Re: i need ideas/comments with tclientsocket
From: Alfred
Date: Tue, 01 Nov 2005 01:02
Date: Tue, 01 Nov 2005 01:02
43 lines
2302 bytes
2302 bytes
Great code, I learned a lot with it :)
> if( (Buffer->Position + Len) >= Buffer->Size )
> {
> Buffer->Seek(-sizeof(int), soFromCurrent);
> break;
> }
Are it correct ? I have tryed it but it execute always the Buffer->Seek routine even if the message is complete, i have changed it in :
if( (Buffer->Position + Len) > Buffer->Size )
it work now. It is correct ?
I have tryed a ProcessPacket routine like :
void__fastcall TForm1::ProcessPacket(TCustomWinSocket *Socket, void *Data, int DataLength)
{
// process Data as needed...
char *a = new char[DataLength];
a = (char*)Data;
Memo->Lines->Add(AnsiString(a,DataLength));
delete[] a;
}
It dont work.. why not ? Sender program send an example with :
char *buf=new char[10];
buf = "1234567890";
int size=10;
Socket->SendBuf ( &size, sizeof(int) );
Socket->SendBuf ( buf , size );
and the receiver write only not ascii chars. What is wrong ?
>> I dont like indy
>
>Why not?
>
I like to program all by myself so I can learn as much as possible. If I used indy my code was already finished but I never knowed a lot of info I am learning right now.
Thank you very much all for the help
Alfred
Technical Details
Message-ID:
<4366ccd3$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<43662baf$1@newsgroups.borland.com> <43667112$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,5c33b8c6a9ca7fdb X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Alfred" <alf@no.spam.not.valid.email> Sender: "Alfred" <alf@no.spam.not.valid.email> Reply-To: "Alfred" <alf@no.spam.not.valid.email> Subject: Re: i need ideas/comments with tclientsocket Newsgroups: borland.public.cppbuilder.internet.socket X-User-Info: 82.52.136.128 References: <43662baf$1@newsgroups.borland.com> <43667112$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <4366ccd3$1@newsgroups.borland.com> Date: 31 Oct 2005 18:02:59 -0700 X-Trace: newsgroups.borland.com 1130810579 207.105.83.66 (31 Oct 2005 18:02:59 -0700) Lines: 43 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail