Article View: borland.public.cppbuilder.internet.socket
Article #2379Re: TServerSocket SendText Exception
From: Eric Patterson
Date: Thu, 20 Apr 2006 15:21
Date: Thu, 20 Apr 2006 15:21
63 lines
3386 bytes
3386 bytes
Mr. Gambit I believe I understand how the ServerSocket should be used. I have though had this setup working flawlessly until I moved to windows xp; I was running on nt which makes me reluctent to change my code drastically. I did finally get a good stack call trace of the exception that is being thrown and it is an invalid pointer exception and the stack looks like this: Module Unit Method Line ----------------------------------------------------- VCL50.BPL System.pas _FreeMem VCL50.BPL System.pas _LStrClr VmeServer.exe MsgServer.cpp Execute 56 The starting point of the exception is coming from this line (line 56 in MsgServer.cpp): while(Server->ServerSocket1->Socket->Connections[ii]->SendText(AnsiString(AMsg+"\n"))==-1) I also did some digging into onError errorCodes that the serverSocket can be throwing and I found at no time does my application go into the onError function. So I am hoping you have some insight into this invalid pointer exception coming from SendText. Thanks again Eric "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:4443ca2a$1@newsgroups.borland.com... > > "Eric Patterson" <eric.patterson@bepco.com> wrote in message > news:44439c71$1@newsgroups.borland.com... > >> I check to make sure there is an active connection right before I do >> a SendText and pass it an ansistring. > > Your code is not using SendText() correctly in general. You are not > taking > into account that SendText() may not send all of your data in a single > operation, requiring you to re-call SendText() multiple times in a loop in > order to send all of your string. Please go to http://www.deja.com and > search through the newsgroup archives. Sample code has been posted many > times before. > > The exception is being thrown at random times usually after running more >> then 6 hours. The exception that is being thrown is an invalid integer >> exception. > > Do you mean that you are getting an EListError exception with a message of > "List index out of bounds (12345)" ? If so, then the only way that > particular exception can occur in the code you showed is if you are > passing > an incorrect index value to the Connections[] property. > > > Gambit > >
Technical Details
Message-ID:
<4447a6f6$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<44439c71$1@newsgroups.borland.com> <4443ca2a$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> Subject: Re: TServerSocket SendText Exception Date: Thu, 20 Apr 2006 11:21:28 -0400 Lines: 65 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 NNTP-Posting-Host: 70.225.107.130 Message-ID: <4447a6f6$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1145546486 70.225.107.130 (20 Apr 2006 08:21:26 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail