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
  1. Home
  2. General Programming
  3. WCF and WF
  4. Send Data Parallaly to Clients

Send Data Parallaly to Clients

Scheduled Pinned Locked Moved WCF and WF
helpcsharpdatabasewcfdata-structures
2 Posts 2 Posters 3 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.
  • S Offline
    S Offline
    shriram gunjotikar
    wrote on last edited by
    #1

    Hi, I have written a publish service in WCF which publishes some data to the clients who have subscribed to the particular topic. For that I am retrieving the list of clients from the database and sending data to the clients. But the problem here is it is sending data serially. I mean according to the order in which the clients are saved in the database. For example client1 receives message at 12.30.41 and client 200 receives message at 12.31.55. Is there any way I can send the data at one shot? Here is the code: static void Publish(T[] subscribers,bool closeSubscribers, string methodName, params object[] args) { WaitCallback fire = delegate(object subscriber) { Invoke(subscriber as T,methodName,args); if(closeSubscribers) { using(subscriber as IDisposable) {} } }; Action queueUp = delegate(T subscriber) { ThreadPool.QueueUserWorkItem(fire,subscriber); }; Array.ForEach(subscribers,queueUp); } static void Invoke(T subscriber,string methodName,object[] args) { Type type = typeof(T); MethodInfo methodInfo = type.GetMethod(methodName); try { methodInfo.Invoke(subscriber,args); } catch {} } Please help.

    F 1 Reply Last reply
    0
    • S shriram gunjotikar

      Hi, I have written a publish service in WCF which publishes some data to the clients who have subscribed to the particular topic. For that I am retrieving the list of clients from the database and sending data to the clients. But the problem here is it is sending data serially. I mean according to the order in which the clients are saved in the database. For example client1 receives message at 12.30.41 and client 200 receives message at 12.31.55. Is there any way I can send the data at one shot? Here is the code: static void Publish(T[] subscribers,bool closeSubscribers, string methodName, params object[] args) { WaitCallback fire = delegate(object subscriber) { Invoke(subscriber as T,methodName,args); if(closeSubscribers) { using(subscriber as IDisposable) {} } }; Action queueUp = delegate(T subscriber) { ThreadPool.QueueUserWorkItem(fire,subscriber); }; Array.ForEach(subscribers,queueUp); } static void Invoke(T subscriber,string methodName,object[] args) { Type type = typeof(T); MethodInfo methodInfo = type.GetMethod(methodName); try { methodInfo.Invoke(subscriber,args); } catch {} } Please help.

      F Offline
      F Offline
      fingerss5
      wrote on last edited by
      #2

      Hey can you try using loops

      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