Article View: borland.public.cppbuilder.internet.socket
Article #4939Re: Socket Runtime questions (Again)
From: Omar Zelaya
Date: Thu, 18 Nov 2004 17:19
Date: Thu, 18 Nov 2004 17:19
75 lines
2899 bytes
2899 bytes
add __fastcall to your sock_error function declaration.
//in h file
void __fastcall sock_error(TObject *Sender,
TCustomWinSocket *Socket,
TErrorEvent ErrorEvent,
int &ErrorCode);
// in cpp file
void __fastcall sock_error(TObject *Sender,
TCustomWinSocket *Socket,
TErrorEvent ErrorEvent,
int &ErrorCode)
{
//ErrorCode = 0;
}
"Dev Support" <infsoft@centurytel.net> wrote in message
news:419cd7f5@newsgroups.borland.com...
> hello all:
>
> Below is sample code that is attempting to create some clientscoket
> components at runtime AND assign my own OnError function to avoid
> repetition
> writing! I keep getting the error :
>
> [C++ Error] sock100.cpp(59): E2034 Cannot convert 'void (*)(TObject
> *,TCustomWinSocket *,TErrorEvent,int &)' to 'void (_fastcall *
> (_closure )(TObject *,TCustomWinSocket *,TErrorEvent,int &))(TObject
> *,TCustomWinSocket *,TErrorEvent,int &)'
>
> I'm certain that my prototype for sock_error is wrong but can comeone tell
> me what it should be?
>
> Thank you
>
> Marshall
>
>
> void sock_error(TObject *Sender,
> TCustomWinSocket *Socket,
> TErrorEvent ErrorEvent,
> int &ErrorCode)
> {
>
>
>
>
> //ErrorCode = 0;
> }
>
>
> int sock_create_sockets(TComponent *owner, int qty)
> {
> int c = 0;
> int count = 0;
>
> if (qty > MAXSOCKS)
> return -1;
>
> for (c = 0; c < qty; c++)
> {
> sock[c] = new TClientSocket(owner);
> sock[c]->OnError = sock_error; <<---------ERROR
> count++;
> }
>
> return count;
> }
>
>
Technical Details
Message-ID:
<419cdb05$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.zanker.org!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<419cd7f5@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,18bd2c5dd1b06641 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Omar Zelaya" <ozelaya2010@hotmail.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <419cd7f5@newsgroups.borland.com> Subject: Re: Socket Runtime questions (Again) Date: Thu, 18 Nov 2004 11:19:09 -0600 Lines: 77 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 200.30.163.216 Message-ID: <419cdb05$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1100798725 200.30.163.216 (18 Nov 2004 09:25:25 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.zanker.org!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail