🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3051

Re: Timeout Issues [Indy 9]

#3051
From: Darlington ADIBE
Date: Tue, 29 Nov 2005 08:30
84 lines
3807 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:438b859f$1@newsgroups.borland.com...

> The first is the actual COM declaration.  The second is a Borland wrapper
> that calls the first one, as well as performs basic error handling to
throw
> an exception when a COM error is reported.

Then it will been more correct to alway call the second method and allow the
wrapper to do it basic function rather than bypass it by calling the first
(actual) declaration ie:

this

WideString result;
result = COMObj->sendSMS(WideString("test"),WideString("number"));

instand of this

WideString result;
if( COMObj->sendSMS(WideString("some text here"), WideString("some number
here"),  &result) >= 0 )


but off cousre within a try... catch().


> Yes.  However, you have to be careful with such code.  WideString has some
> quirky behavior that can cause memory leaks if you are not aware of how
you
> are using it.  In particular, WideString's BSTR constructor makes a copy
of
> the BSTR data but does not take ownership of the original BSTR, whereas
> WideString's BSTR '=' operator does take ownership of the original BSTR.
To
> ensure that the compiler does not accidently cause leaks to occur to your
> code, you should explicitally separate the construction of a WideString
from
> its assignment when passing COM strings to the WideString, ie:

What you are saying is that there is a difference between this

 WideString result;
 result = COMObj->sendSMS(WideString("test"), WideString("number"));

and this

 WideString result  = COMObj->sendSMS(WideString("test"),
WideString("number"));

and that the first is safer for  COM (thats a new one for me)

So far so good, all the above in from the COM user point of view, how about
from the COM developer point of view, which in this case is where i fall
within (Developer).

it more easier if am developing the COM to be used just within my own App.
but in this case my COM is targetted to third party developers.

is including the
public ISupportErrorInfoImpl<&IID_IesemesAPI>

and using
return Error(e.Message.c_str(), IID_IesemesAPI, E_UNEXPECTED);

to return Error good enough for my COM such that the third party developer
can use all the standard error handling routin you have mentioned so far
(for VB & C++).

Which of this method do i document for the COM user

this
 HRESULT         __fastcall sendSMS(BSTR SMSText/*[in]*/, BSTR
ToNumber/*[in]*/,  BSTR* pVal/*[out,retval]*/);

or this
 BSTR            __fastcall sendSMS(BSTR SMSText/*[in]*/, BSTR
ToNumber/*[in]*/);

other commerical COM API alway document the second.

Thanx
Darl
Technical Details
Message-ID: <438c1166@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.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
References: <43864c38@newsgroups.borland.com> <4386ba83$1@newsgroups.borland.com> <43878392@newsgroups.borland.com> <438b485b$1@newsgroups.borland.com> <438b5b9d@newsgroups.borland.com> <438b859f$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,83a059fbd8c24375
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Darlington ADIBE" <bcb@triative.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <43864c38@newsgroups.borland.com> <4386ba83$1@newsgroups.borland.com> <43878392@newsgroups.borland.com> <438b485b$1@newsgroups.borland.com> <438b5b9d@newsgroups.borland.com> <438b859f$1@newsgroups.borland.com>
Subject: Re: Timeout Issues [Indy 9]
Date: Tue, 29 Nov 2005 09:30:34 +0100
Lines: 88
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
NNTP-Posting-Host: 83.229.68.10
Message-ID: <438c1166@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1133252966 83.229.68.10 (29 Nov 2005 00:29:26 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.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