🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Socket Runtime questions (Again)

#4937
From: Dev Support
Date: Thu, 18 Nov 2004 19:26
49 lines
1907 bytes
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: <419cd7f5@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,18bd2c5dd1b06641,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Dev Support" <infsoft@centurytel.net>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Socket Runtime questions (Again)
Date: Thu, 18 Nov 2004 11:26:46 -0800
Lines: 51
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 69.29.175.192
Message-ID: <419cd7f5@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1100797941 69.29.175.192 (18 Nov 2004 09:12:21 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail