Simple network simulation in C