If you're serving webpages, look for a networking library that handles HTTP.
If you're sending arbitrary chunks of data (like for a game), use a socket library. I've used WebSockets in the past, which handles the low-level stuff under the hood. There are libraries that implement it for Java, Go, C++, JS, etc. Check it out at https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_...
It's not totally headache-free though - some issues I ran into were:
If you're sending arbitrary chunks of data (like for a game), use a socket library. I've used WebSockets in the past, which handles the low-level stuff under the hood. There are libraries that implement it for Java, Go, C++, JS, etc. Check it out at https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_...
It's not totally headache-free though - some issues I ran into were:
- running locally vs over the internet
- data formatting
- recovering from timeouts/dropped connections