made send packet function and error packet type