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

  • SEARCH
  • Home
  • 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 3317828
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:37:59+00:00 2026-05-17T22:37:59+00:00

I’m a good programmer, but I have zero network experience. Basically, I’d like to

  • 0

I’m a good programmer, but I have zero network experience.

Basically, I’d like to get into client-server networking. For example, I’d like to try getting a server process going which allows clients to connect over the internet and send pings to all of the other connected clients. Then maybe I’ll try developing a simple chat client, or some simple multiplayer game and I’ll go from there.

Languages I know very well that might be useful: Java, C++, C.

How do I get started? I want to learn best-practices up front, so good learning resources you can recommend (eg books, online materials, etc) would be great.

Edit: Should I also look into some kind of VM to emulate various machines interacting with each other?

Edit 2: I’ve put up a 50-rep bounty. Some great answers have been put up so far – I’m looking for more detailed answers though, so hopefully this will encourage that. For example an answer by someone with experience in this type of stuff that compares different learning approaches would be really helpful. Thanks! Also could I get some feedback on the whole VM thing?

  • 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-17T22:37:59+00:00Added an answer on May 17, 2026 at 10:37 pm

    I prefer Java. I’m going to explain TCP:
    The basic concept is that you have to run a “Server” on a machine. That server accepts clients waiting for a connection. Each connection goes over a port (you know, I hope…).
    Always use ports above 1024 because ports lower than 1025 are most of the time reserved for standard protocols (like HTTP (80), FTP (21), Telnet, …)

    However, creating a Server in Java is done this way:

    ServerSocket server = new ServerSocket(8888); // 8888 is the port the server will listen on.
    

    “Socket” is the word you are probably looking for if you want to do research.
    And to connect your client to a server you have to write this:

    Socket connectionToTheServer = new Socket("localhost", 8888); // First param: server-address, Second: the port
    

    But now, there isn’t still a connection. The server has to accept the waiting client (as I noticed here above):

    Socket connectionToTheClient = server.accept();
    

    Done! Your connection is established! Communicating is just like File-IO. The only thing you have to keep in mind is that you have to decide when you want to flush the buffer and really send the data through the socket.
    Using a PrintStream for text-writing is very handy:

    OutputStream out = yourSocketHere.getOutputStream();
    PrintStream ps = new PrintStream(out, true); // Second param: auto-flush on write = true
    ps.println("Hello, Other side of the connection!");
    // Now, you don't have to flush it, because of the auto-flush flag we turned on.
    

    A BufferedReader for text-reading is the good (best*) option:

    InputStream in = yourSocketHere.getInputStream();
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    String line = br.readLine();
    System.out.println(line); // Prints "Hello, Other side of the connection!", in this example (if this would be the other side of the connection.
    

    Hopefully you can start with networking with this information!
    PS: Of course, all networking code have to be try-catched for IOExceptions.

    EDIT: I forgot to write why it isn’t always the best option. A BufferedReader uses a buffer and read as much as it can into the buffer. But sometimes you don’t want that the BufferedReader steals the bytes after the newline and put them into his own buffer.
    Short example:

    InputStream in = socket.getInputStream();
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    // The other side says hello:
    String text = br.readLine();
    // For whatever reason, you want to read one single byte from the stream,
    // That single byte, just after the newline:
    byte b = (byte) in.read();
    

    But the BufferedReader has already that byte, you want to read, in his buffer. So calling in.read() will return the byte following on the last byte in the buffer of the reader.

    So, in this situation the best solution is to use DataInputStream and manage it your own way to know how long the string will be and read only that number of bytes and convert them into a string. Or: You use

    DataInputStream.readLine()

    This method doesn’t use a buffer and reads byte by byte and checks for a newline. So this method doesn’t steal the bytes from the underlying InputStream.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.