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. re: winsock multiplexed server using select()

re: winsock multiplexed server using select()

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialc++cssvisual-studiosysadmin
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.
  • A Offline
    A Offline
    Alan Kurlansky
    wrote on last edited by
    #1

    I have a VS C++ server app that listens for client tcp connections, maintains them in a table, and when the server app receives a message from an app it is a proxy for the server app sends the message to each tcp connection. There will be no more than five connections and the message rate is less than one per second. Now I need to be able to also read any messages coming in from the clients over the same connection. So on one thread, the main one, I am receiving and forwarding msgs from the app I am proxy for to the clients; on another thread I am listening for any new connections; and now I would like to listen for client input from any of the connected clients on a 3rd thread using select(). I maintain a list of all my active connections. Can anyone provide and example using select() that sketches out how to do this. Thanks

    M 1 Reply Last reply
    0
    • A Alan Kurlansky

      I have a VS C++ server app that listens for client tcp connections, maintains them in a table, and when the server app receives a message from an app it is a proxy for the server app sends the message to each tcp connection. There will be no more than five connections and the message rate is less than one per second. Now I need to be able to also read any messages coming in from the clients over the same connection. So on one thread, the main one, I am receiving and forwarding msgs from the app I am proxy for to the clients; on another thread I am listening for any new connections; and now I would like to listen for client input from any of the connected clients on a 3rd thread using select(). I maintain a list of all my active connections. Can anyone provide and example using select() that sketches out how to do this. Thanks

      M Offline
      M Offline
      Moak
      wrote on last edited by
      #2

      Hi Alan! Here a couple of thoughts... a) where's the difference between "the app" and the "server app", are these different processes? b) you mention incoming sockets are maintained in a "table" later a "list", what kind of data structure is this? c) what do you plan to do with the data from incoming clients, forward it to someone and how (callbacks, IPC, etc)? d) do you have to use select(), well, you probably don't want to mix multi-threading and non-blocking sockets? e) why do you start every new messages with "re:"? Questions over questions :) /Moak

      Chat in Europe :java: Now with 24% more Twitter

      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