private void ProcessReceive(UniNetObject uniObject) { //bad connection if (uniObject.ObjectError != Error.NetCoreError.Success) { ProcessBadConnection(uniObject); return; } if (_isRunning != true) { ProcessStop(uniObject); return; } //if (connectionArgs.BytesTransferred == 0) //{ // (connectionArgs.UserToken as SocketStateObject).socket.Shutdown(SocketShutdown.Both); // return; //} //bad connection //receive //byte[] buffer = new byte[connectionArgs.BytesTransferred]; //Socket clientSocket = (connectionArgs.UserToken as SocketStateObject).socket; //Array.Copy(connectionArgs.Buffer, buffer, connectionArgs.BytesTransferred); byte[] buffer = uniObject.ReceiveAll(); if (buffer == null) { ProcessBadConnection(uniObject); return; } //receive NetCore.Error.NetCoreException err; var State = _Callback.Received(buffer, uniObject, out err, uniObject.stateObject); if (err != null) { ProcessBadConnection(uniObject); return; } uniObject.stateObject = State; }