Skip to main content
Share Your Experience: Take the 2024 Developer Survey
30 votes
Accepted

Simple and effective port checker in C++

Checking TCP ports and multi-threading Your performance should be fine for a sequential program. Another way to check whether the TCP port is open is by just sending the initial ...
Zeta's user avatar
  • 19.3k
26 votes
Accepted

C# TCP server/client class

Networking You have done the classic thing that all people new to TCP do of assuming that whatever NetworkStream.Read gives you will be some meaningful chunk of ...
VisualMelon's user avatar
  • 7,431
20 votes

Send messages in TCP-based communication system

Networking Concerns I'm going to assume that stream is a NetworkStream in the Server. It is really really important that you ...
VisualMelon's user avatar
  • 7,431
18 votes
Accepted

C++ Linux TCP client/server socket wrapper

Design This is a very thin C like wrapper around sockets. In my opinion there are a lot of style changes that are need to make this good C++ or usable by modern C++ library. Main issues: Two phase ...
Martin York's user avatar
  • 95.2k
14 votes
Accepted

Asynchronous TCP server

This is an ugly old pattern. Why don't just try the newer async/await? You already use Task in your tests anyway. In order to ...
t3chb0t's user avatar
  • 44.3k
13 votes
Accepted

Event Based TCP Library

This won't be comprehensive review/ramble, because I'm hungry; however, it is nice to see fairly comprehensive inline documentation on the public API! General Networking Commentary Because you asked ...
VisualMelon's user avatar
  • 7,431
12 votes

TCP client reconnection logic running on 30 machines

catch (Exception) { Reconnect(); } The same pattern can be found in almost every method. Are you not interested in what happened? No logging or anything? Just ...
t3chb0t's user avatar
  • 44.3k
10 votes

C# TCP server/client class

Review This review handles readability metrics and C# conventions only and should provide insights to reach some of your goals. Goals: learn C#, improve coding style, create good to read code ...
dfhwze's user avatar
  • 13.9k
9 votes

TCP client reconnection logic running on 30 machines

apart from what @t3chb0t has recommended, Reconnect should implement something like exponential back off or at least increase the sleep time also your ...
Abdullah Saleem's user avatar
9 votes

TCP server in C++

Header files should end in .h or .hpp Everything except Program.cpp looks like a header file, not a source file. Make sure the filenames of the header files end in .hpp. See this StackOverflow ...
G. Sliepen's user avatar
  • 57.2k
8 votes
Accepted

TCP client reconnection logic running on 30 machines

Being that both Timer and SimpleTcpClient implement IDisposable, your class should also ...
Jesse C. Slicer's user avatar
8 votes
Accepted

TCP client and server API

I don't understand the point of the IComponent / IComponentConsumer stuff. Nothing else in the large section of code you've ...
Peter Taylor's user avatar
  • 24.1k
8 votes
Accepted

Correctly applying the "rule of five" to a RAII socket wrapper

These are good questions! 1. You should indeed have the copy constructor & assignment operator deleted. The "rule of five" tells you to specifically define a copy c'tor and assignment ...
einpoklum's user avatar
  • 2,015
6 votes
Accepted

Async TCP client/server

Async/Await Async/await's main advantage is that you no longer need to use ContinueWith() to chain tasks, making the code much cleaner. Your code seems to more ...
D. Jurcau's user avatar
  • 3,010
6 votes

Multithreaded C# TCP Socket Server

I am kinda new to reviewing code but I know c# kind good and will try my best. First, let's go over some code style issues. At the top you declared variables like this: ...
Patrick Hollweck's user avatar
6 votes

Correctly applying the "rule of five" to a RAII socket wrapper

There's one major problem with the code: Your move assignment is broken. You forgot to close(_s) before overwriting it with ...
HolyBlackCat's user avatar
5 votes

Common client server implementation

Who am I? When skimming the code, it's not obvious to a reader what the significance of checking whether a string starts with the letter "c". ...
jacwah's user avatar
  • 2,661
5 votes
Accepted

Server connection handler in Python

1. Review There are no docstrings. What do these functions and classes do? How do I use them? In Python, it's conventional to use a single underscore to indicate a method that's only intended for use ...
Gareth Rees's user avatar
  • 49.6k
5 votes

My first implementation of a client/server application

Naming Usually, local variables start with a small letter. StartListening If the method is called multiple times, it will throw an exception that the endpoint is already in use. Not very robust. <...
JanDotNet's user avatar
  • 8,538
5 votes

Simple TCP Send Receive with multithreading c#

There are several things that can be improved on the current code. Starting by the listener, if you want to create a TcpListener you can use ...
Bruno Costa's user avatar
  • 5,566
5 votes
Accepted

Tcp server messenger awaiter in f#

The first thing is when you use parenthesis it means that you pass a tuple to a function instead of single parameters. So you can ditch them. The second thing is that ...
Bohdan Stupak's user avatar
5 votes
Accepted

C++ sockets: Sending structs for P2P communication

Overview You use a single connection for all communication. This will make it hard to fix a broken/dropped connection. Better to make each message (request/response) its own connection. You can re-use ...
Martin York's user avatar
  • 95.2k
5 votes
Accepted

Learning Sockets in C# (.Net Framework), Suggested Improvements?

Disposing of Disposables The main problem in your code is that you are not disposing of clientWriter. A good rule to remember is that you should always dispose of ...
jdt's user avatar
  • 2,362
5 votes
Accepted

Simple Redis implementation in Rust

Don’t Panic! (On Runtime Errors) I admit I’ve sometimes put an .expect() or .unwrap() in my code examples, for simplicity. But ...
Davislor's user avatar
  • 7,546
4 votes

Python 3 NetScanner Daemon

Baseline quality As you say this project is near to your heart. I suggest to try the PyCharm IDE, community edition. It has a built-in PEP8 validator and will give you many warnings on coding style, ...
janos's user avatar
  • 111k
4 votes

Python 3 NetScanner Daemon

Ok, so I'll try to comment on this code as much as I can, but due to the fact that you said: Requires Python 3 and OSX to run. Note that this could also be the reason some users don't review your ...
Grajdeanu Alex's user avatar
4 votes
Accepted

Simple Go TCP server and client

Your reverse, and swapCase functions are good. The native use of runes is great, and the functions are clear, etc. If I was to ...
rolfl's user avatar
  • 97.4k
4 votes
Accepted

TCP authentication server and client

You seem to be doing a lot of low-level byte manipulation when using the sockets. Once you have a NetworkStream, just wrap it inside a ...
D. Jurcau's user avatar
  • 3,010
4 votes
Accepted

16-bit Checksum function in C

Since this checksum function is only used for TCP packets, there is no need for supporting packets larger than 65535 bytes. Rather than adding needless overflow checks, you should restrict the ...
Roland Illig's user avatar
  • 21.3k
4 votes

Simple and effective port checker in C++

Here are some things that may help you improve your program. Use the required #includes The code uses memcpy and ...
Edward's user avatar
  • 66.4k

Only top scored, non community-wiki answers of a minimum length are eligible