Refactoring of send and recv usage in server and client

Also moved server functions to above main(). Opted to use C macros because it is easier for the compiler to deal with expanding the macro then for me to setup dereferencing stuff on void pointer.