UNIX & GNU/Linux - System calls - Difference between fork() and vfork()

The fork() and vfork() syscalls are different.

The fork() syscall generates two identical processes with separate memory.
The vfork() syscall generates two processes that share the same memory.

C - Mathematics - Using the Luhn algorithm

Maybe you wonder if your credit card has a correct number?

How to know that?
With the Luhn formula!
This is what we are going to see in this Luhn tutorial.

This algorithm can say if it is a good or a bad credit card number.

C - Mathematics - Find prime numbers

If you have a good computer, you can maybe try to find the last prime number that nobody found yet.

Indeed, you can even win a prize for that!
But you have to find a number with more than millions of digits.

I'm sure you can do it.

C - Mathematics - Fraction simplifier

Today, I inaugurate a new C section: mathematics.

The first tutorial is a way to simplify a fraction.

C - TCP/IP - Writing and reading on a socket

This tutorial will help us to understand how to write and read on a client side and display the result on the server side.

So, for that, we have to create a server and a client.
The client will be the nc tool (or telnet if you prefer, this is the same for this example).

C - Library functions - Using inet_ntoa()

The inet_ntoa() function C returns the address of a client side, for example.

We give to the unique inet_ntoa() parameter, a struct in_addr.
We can then retrieve the address of this parameter.

Let's look it in this tutorial with an example of code.

UNIX & GNU/Linux - System calls - Using accept()

The accept() system call waits a connection from a client.

For the example above, we are going to take the nc tool (you can use telnet, it is the same).

If we reach the server through the nc connection, the server will shutdown.
But that's what we want to do.

UNIX & GNU/Linux - System calls - Using listen()

The listen() system call is designed to tell that a socket is ready to accept incoming connection.

Of course, we need first implementing the socket() and bind() system calls.

We are talking here about the server side.

UNIX & GNU/Linux - System calls - Using bind()

The bind() system call function is used with socket().

It assigns the address of the second argument to the file descriptor retrieved by socket().
Of course before using bind(), we must have a valid fd generated by socket().

UNIX & GNU/Linux - System calls - Using socket()

The socket() system call function will help us to create an end point.

This end point will allow for example to connect a client to a server.
Indeed, both of them (client and server) will have a socket() system call function on their implementation.

Pages

Subscribe to BadproG.com RSS