input partly done

I have completed about half of the input catching. Regular keys are sent
to the server, but no system keys like Ctrl, Shift, etc.. The mouse
works except the scroll wheel. Fixed a couple of small bugs in the
network code as well.