Article View: borland.public.cppbuilder.internet.socket
Article #2392Re: TServerSocket SendText Exception
From: Eric Patterson
Date: Fri, 21 Apr 2006 16:52
Date: Fri, 21 Apr 2006 16:52
59 lines
2813 bytes
2813 bytes
I seem to still have an invalid pointer. I was using this snippet:
TCustomWinSocket *Socket =
Server->ServerSocket1->Socket->Connections[ii];
AnsiString temp = AMsg + "\n";
int len;
while( temp.Length() > 0 )
{
len = Socket->SendText(temp);
if( len > 0 )
{
--> temp = temp.SubString(len+1, MaxInt);
continue;
}
if( (len == -1) && (WSAGetLastError() == WSAEWOULDBLOCK) )
{
Sleep(10);
continue;
}
break;
}
The exception occured on the line using SubString function (denoted with an
arrorw). I looked at the details of the SubString method and in this case
it will return a substring starting at len+1 and go all the way to MaxInt.
I am going to attempt using the sendbuf example that you provided since that
makes more sense and I can control the bounds of the pointers. I do have a
question regarding AnsiStrings now though: when using an equal operator is
that doing a copy from one memory location to another or is that just
creating another pointer to point to the same location AMsg is sitting?
Maybe my AMsg array is being taken way before sendbuf (or sendtext) is done
with it.
Eric
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:44480aa5$1@newsgroups.borland.com...
>
> "Eric Patterson" <eric.patterson@bepco.com> wrote in message
> news:4447c0b0$1@newsgroups.borland.com...
>
>> That is all fine but why?
>
> I already gave you a detailed explanation about that. Please go re-read
> my
> earlier reply more closely.
>
>> I would love to fix my issue
>
> Then please try the code I already gave you.
>
>
> Gambit
>
>
Technical Details
Message-ID:
<44490de6$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<44439c71$1@newsgroups.borland.com> <4443ca2a$1@newsgroups.borland.com> <4447a6f6$1@newsgroups.borland.com> <4447b917$3@newsgroups.borland.com> <4447c0b0$1@newsgroups.borland.com> <44480aa5$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,fea0b13af0f4efa8 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Eric Patterson" <eric.patterson@bepco.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <44439c71$1@newsgroups.borland.com> <4443ca2a$1@newsgroups.borland.com> <4447a6f6$1@newsgroups.borland.com> <4447b917$3@newsgroups.borland.com> <4447c0b0$1@newsgroups.borland.com> <44480aa5$1@newsgroups.borland.com> Subject: Re: TServerSocket SendText Exception Date: Fri, 21 Apr 2006 12:52:54 -0400 Lines: 61 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 70.225.107.130 Message-ID: <44490de6$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1145638374 70.225.107.130 (21 Apr 2006 09:52:54 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail