Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6090701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:14:39+00:00 2026-05-23T12:14:39+00:00

I have no experience with sockets nor multiplayer programming. I need to code a

  • 0

I have no experience with sockets nor multiplayer programming.
I need to code a multiplayer mode for a game I made in c++. It’s a puzzle game but the game mode will not be turn-based, it’s more like cooperative.
I decided to use UDP, so I’ve read some tutorials, and all the samples I find decribes how to create a client that sends data and a server that receives it.
My game will be played by two players, and both will send and receive data to/from the other.

Do I need to code a client and a server?
Should I use the same socket to send and receive?
Should I send and receive data in the same port?

Thanks, I’m kind of lost.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:14:40+00:00Added an answer on May 23, 2026 at 12:14 pm

    Do I need to code a client and a server?

    It depends. For a two player game, with both computers on the same LAN, or both on the open Internet, you could simply have the two computers send packets to each other directly.

    On the other hand, if you want your game to work across the Internet, when one or both players are behind a NAT and/or firewall, then you have the problem that the NAT and/or firewall will probably filter out the other player’s incoming UDP packets, unless the local player goes to the trouble of setting up port-forwarding in their firewall… something that many users are not willing (or able) to do. In that case, you might be better off running a public server that both clients can connect to, which forwards data from one client to another. (You might also consider using TCP instead of UDP in that case, at least as a fallback, since TCP streams are in general likely to have fewer issues with firewalls than UDP packets)

    Should I use the same socket to send and receive?
    Should I send and receive data in the same port?

    You don’t have to, but you might as well — there’s no downside to using just a single socket and a single port, and it will simplify your code a bit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some experience making multiplayer turn-based games using sockets, but I've never attempted
I am new to C++ network programming but have experience with Java sockets etc.
I have very little experience working with sockets and multithreaded programming so to learn
I have some experience with programming, but I have very little experience when it
I have no experience with sockets and I need to implement a process that
Anyone have experience with this plugin? I have it installed but I have no
I have some experience with socket programming using the Berkeley socket API in C.
I don't have much experience doing unit testing. From what I learned, code should
Anyone have experience with algorithmic trading (like stocks)? Any good services to use to
Anyone have experience with adding a ReSharper profile to the VS2008 solution and share

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.