int EndRead(IAsyncResult ar, out Exception error) { error = null; try { return(socket.EndReceive(ar)); } catch (Exception e) { error = e; return(-1); } }