Please note that this code is rather old and not the best way, it was only meant as an quick example.
There are security issues in it and the connection isn't threaded, which means it could/will pause the server until a connection is made.
For a more intermediate example i currently can only link you to
this, it's not optimal or trivial, but it's commented and uses all common tasks you might need to know.
__________________