os/server: Fix possible port overflow
- add documentation about port being optional
- parse port into long and check for valid value