🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: sockets????

#3350
From: Remy Lebeau (TeamB)
Date: Sun, 23 Oct 2005 17:10
48 lines
3176 bytes
"Gary D" <gcdesroches@nctc.com> wrote in message 
news:435bbbf2$1@newsgroups.borland.com...

> If you can make a COM server broadcast without needing a request
> from a client can you tell me how you did it?

Event sinks.  A client registers a sink with the server, and then the server 
can trigger events to that sink whenever it wants.  A common way to do that 
is via Connection Points.  When you create a new COM object in the IDE's 
ActiveX wizards, you have an option to "Generate Event Support".  This 
option adds an additional IDispatch-derived interface to your Type Library 
where you can then define your event methods.  The COM object's Impl class 
will then have a TEvent_... class added to its ancestor list which 
implements Fire_...() methods for the events.  The server code can call 
these methods at any time to trigger events in connected clients.  The 
client's code can then derive a class from that interface, or alternatively 
use the VCL's TEventDispatcher class, to implement the event handling as 
needed.  In the case of TEventDispatcher, it has a ConnnectServer() method 
that you can use to hook up the TEventDispatcher to your COM object 
instance.  If you don't use TEventDispatcher, then you have to manually 
query the COM object for the IConnectionPointContainer interface, call its 
FindConnectionPoint() method to get an IConnectionPoint interface, and then 
finally call its Advise() method passing it an instance of your sink class.

Refer to the following articles for more details:

    Events/Callbacks
    http://www.techvanguards.com/com/concepts/events.asp

    Implementing an Event Framework
    http://www.techvanguards.com/com/tutorials/eventsystem.asp

The code examples are in Delphi, but the concepts can be applied to C++ as 
well.

> Borland support says it can't be done.

What EXACTLY was said?

> ( Remember it's an UNSOLICITED broadcast I'm after, no client
> involvment other than receiving )

The client has to register its interest in receiving events.  You can do 
that right after instantiating the COM object.


Gambit 
Technical Details
Message-ID: <435bc353$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!peer01.west.cox.net!cox.net!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: <43599303@newsgroups.borland.com> <43599f5f$1@newsgroups.borland.com> <435bbbf2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,b9d755a2fd611a30
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <43599303@newsgroups.borland.com> <43599f5f$1@newsgroups.borland.com> <435bbbf2$1@newsgroups.borland.com>
Subject: Re: sockets????
Date: Sun, 23 Oct 2005 10:10:19 -0700
Lines: 50
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; Response
NNTP-Posting-Host: 69.175.11.30
Message-ID: <435bc353$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1130087251 69.175.11.30 (23 Oct 2005 10:07:31 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!peer01.west.cox.net!cox.net!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