Welcome to my blog’s first tutorial series!
What’s going on guys? Are ready to keep on coding?
In this part we won’t write too much code, mostly we’re going to focus on the building blocks to setup our server thread in the future.
This includes setting up a few variables, some new functions and some overall analysis into how the server thread is going to work.
I already explained in the overview how the program is going to operate in regards to handling clients but now we’re actually going under the hood.
Without further ado, let’s code!
Dive Into The Code
On the server script, we’re going to add two new functions:
- CheckAddr(port, verbose)
The purpose of these functions will become clear later on, but for the time being we are going to use them to check if the IP address we chose as a host is available; while the second function will work to find an available port for the client to connect back to us (in the client thread, which will be developed later on).