Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Connection points for Chat server using ATL/COM

Connection points for Chat server using ATL/COM

Scheduled Pinned Locked Moved ATL / WTL / STL
learningc++comsysadmintutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Raj Prathap
    wrote on last edited by
    #1

    Hi, I'm planning to implement a chat server + a chat client as a learning exercise for my ATL/COM/DCOM. As part of that first I would implement a chat server which is a local server and a chat client. Please suggest if the following is possible, if true how. Clients register their callbacks by using Advice() (Of course, I would do FindConnectionPoint(), before that ). My doubt is is there any way to send the notification from the server to all the clients? and also can the server select the client to which it has to send the notification. For Example: User1, User2 are currently logged in. If user1 sends a message to User2 by using SendMsg(from, to, msg) of IChatServer, can the server alert client of User2. Otherwise can server broadcast the event?? Thanks and regards, Raja Pratap

    R 1 Reply Last reply
    0
    • R Raj Prathap

      Hi, I'm planning to implement a chat server + a chat client as a learning exercise for my ATL/COM/DCOM. As part of that first I would implement a chat server which is a local server and a chat client. Please suggest if the following is possible, if true how. Clients register their callbacks by using Advice() (Of course, I would do FindConnectionPoint(), before that ). My doubt is is there any way to send the notification from the server to all the clients? and also can the server select the client to which it has to send the notification. For Example: User1, User2 are currently logged in. If user1 sends a message to User2 by using SendMsg(from, to, msg) of IChatServer, can the server alert client of User2. Otherwise can server broadcast the event?? Thanks and regards, Raja Pratap

      R Offline
      R Offline
      Roger Stoltz
      wrote on last edited by
      #2

      Raj Prathap wrote:

      My doubt is is there any way to send the notification from the server to all the clients? and also can the server select the client to which it has to send the notification.

      It's not clear to me what you mean by "chat server" and "notification". When someone talks about a chat server to me I interpret it as the MSDN sample CHATTER/CHATSRVR[^], but the notification you're talking about feels like a callback on a source interface from a COM server to its client (AKA a COM event). If the notification is a COM event, the answer is that the server keeps track of its clients in a container; a list, vector or array. When an event is generated the container is walked through notifying all registered clients. If you want to skip one of the clients you have to write your own code to do that. A small thought: You don't have to use the connection point concept, in fact Don Box recommends not to use it in his book Effective COM[^]. You can create your own Advise() method and put whatever functionality in it that you want and/or need. But if you're new to this it could be a good starting point using the connection point concept to understand how it works.


      "It's supposed to be hard, otherwise anybody could do it!" - selfquote
      "High speed never compensates for wrong direction!" - unknown

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups