Hi, I am new to C++

I am working with C++ .NET to create a multiplayer game for a project. However I need to connect the multiple computers together, for it to work, with one computer acting as the server and the other (max of 6 others) connecting to it as clients.

I would like to know how to create a multi threaded server and how to connect to it via sockets.

I have very limited experince with sockets in Java, but none in C++.NET, The way the system will work is, the Host listens for connections, players connect, and are logged as having joined, Host player will click play which will send a message to all other players computers to load the play screen, players will make there moves then after 5 minutes or after each player has clicked on OK the moves will be sent back to the server pc where they are checked, the results are then sent out to each pc and then the next turn is started.

Any help would be much appriated, I hope this is enough info to get you started on advise, if you need any more info please ask. The game will be played on modern windows computers only at this stage. :)

You can do this in a few different ways. I don't know windows, so some of the following ways might not work, or might be different.

You can listen for a connection and accept it, then fork out the processess. I dont think windows does this, but it can be a resournce hog.

So, you can thread out the processess. This is a lot faster and kinder on resources.

With a threaded process you can access all global variables, which makes it easier to communicate between connections.

Again, I dont know anything about windows programming so I would recommend reading whatever socket API windows uses. If I remember correctly its the winsock API.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.