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. C / C++ / MFC
  4. how to send data to multiple clients from single server mfc or winsock

how to send data to multiple clients from single server mfc or winsock

Scheduled Pinned Locked Moved C / C++ / MFC
c++sysadmintutorial
4 Posts 3 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.
  • S Offline
    S Offline
    sravu25
    wrote on last edited by
    #1

    hi, how to send data to multiple clients from single server.i can send data to single clients but how to handle multiple client. can any one provide code for that part.

    sravanthi

    H _ 2 Replies Last reply
    0
    • S sravu25

      hi, how to send data to multiple clients from single server.i can send data to single clients but how to handle multiple client. can any one provide code for that part.

      sravanthi

      H Offline
      H Offline
      hanq_38910130
      wrote on last edited by
      #2

      In main thread you listen for client connections. Once you got a client connection, you can create a corresponding socket and thread.Then all the communication can be handled in that thread using that socket. Of course, if there are too many client to deal with, this is not a good way. You can use iocp instead.

      S 1 Reply Last reply
      0
      • S sravu25

        hi, how to send data to multiple clients from single server.i can send data to single clients but how to handle multiple client. can any one provide code for that part.

        sravanthi

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        You can use multicasting for this - http://en.wikipedia.org/wiki/Multicast[^]

        «_Superman_» I love work. It gives me something to do between weekends.
        Microsoft MVP (Visual C++)

        1 Reply Last reply
        0
        • H hanq_38910130

          In main thread you listen for client connections. Once you got a client connection, you can create a corresponding socket and thread.Then all the communication can be handled in that thread using that socket. Of course, if there are too many client to deal with, this is not a good way. You can use iocp instead.

          S Offline
          S Offline
          sravu25
          wrote on last edited by
          #4

          i am using data gram socket where listen and accept will not be used. i want just to handle three to four clients. can u please provide that part of code.

          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