Thread: Best way to achieve this

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    100

    Best way to achieve this

    Hi,

    Im developing a program in C++ to run on my homecomputer and act as a server. I think it will be rather complicted to code efficiently. Basically what I want is to code a multi-threaded server which acts as a "lounge" for a game of coded. All clients should be allowed to connect to the server and chat with each other like an irc room. I also want some clients to be able to host games in the lounge so other users can join there game (the game is 2 player so the "host" and the "joiner" will be connected together not by the server).

    Obviously I dont expect you to code it for me or even come with the protocol. Just the theory behind how the server should operare. I.E adding all clients to an array and continually looping through updating each one with the new info, i.e. a new game being hosted or someone typing a message to the whole lounge.

    Also it would be good to know how I should implement error checking like if one of the hosts got kicked off the internet etc.

    Thanks for any help :-)

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    It sounds like you haven't done any network programming before. This sounds like a fun project, but I would highly recommend you get your feet wet with network communication first.

    Start with creating just a simple echo server first maybe. something the client can connect to and anything the client types is echoed back by the server. Then create a chat room server that can accept multiple clients and stuff people type in the room is sent to all the other clients.

    You'll probably learn all you need to know if you can get those working and they can also serve as the base for the project you're actually working toward.
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 10-31-2008, 01:26 PM
  2. How would I achieve this dynamic_cast?
    By 6tr6tr in forum C++ Programming
    Replies: 17
    Last Post: 04-15-2008, 01:35 AM
  3. Replies: 3
    Last Post: 09-11-2005, 10:13 AM
  4. The more intelligent risks you take in life, the more you'll achieve
    By Terrance in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 05-20-2003, 05:23 PM
  5. Regarding Careers - need advice
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 01-05-2002, 04:59 AM