private void AcceptCallback(IAsyncResult ar)
        {
            allDone.Set();
            Socketoutput socketoutput = (Socketoutput)ar.AsyncState;
            Socket       listener     = (Socket)socketoutput.socket;

            try
            {
                Socket      handler = listener.EndAccept(ar);
                StateObject state   = new StateObject();
                state.workSocket         = handler;
                socketoutput.stateobject = state;
                handler.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, new AsyncCallback(ReadCallback), socketoutput);
            }
            catch (Exception ex)
            {
                socketoutput.Output(string.Format("AcceptCallback,原因:{0}", ex.ToString()), eOutputType.Error);
            }
        }
        private void ReadCallback(IAsyncResult ar)
        {
            String       content      = String.Empty;
            Socketoutput socketoutput = (Socketoutput)ar.AsyncState;
            StateObject  state        = (StateObject)socketoutput.stateobject;

            try
            {
                Socket handler   = state.workSocket;
                int    bytesRead = handler.EndReceive(ar);
                if (bytesRead > 0)
                {
                    state.sb.Append(Encoding.ASCII.GetString(state.buffer, 0, bytesRead));
                    content = state.sb.ToString();
                    PrintRecvMssg(content, socketoutput.interfacetype_chsb, socketoutput.Output);
                }
            }
            catch (Exception ex)
            {
                socketoutput.Output(string.Format("ReadCallback,原因:{0}", ex.ToString()), eOutputType.Error);
            }
        }