socketerror function for the sender to look if a error occurs