Server logic works much better

TODO:
* Detect end of file better
* Print system time in log