Esempio n. 1
0
        public dynamic Create(NetworkData a_oNetData)
        {
            if ((a_oNetData?.DataLength() ?? 0) < 1)
            {
                throw new NetworkDataBufferLessThan1();
            }

            var _oByteData = a_oNetData.Buffer.Take(a_oNetData.DataLength()).ToArray();

            return(Create(_oByteData));
        }
Esempio n. 2
0
        public virtual void AsyncSend(NetworkData a_oData)
        {
            try
            {
                NetworkAction?.NetworkStateChanged(NetworkState.Sending, new StateObject(this, a_oData));

                NetworkSocket?.BeginSend(a_oData.Buffer, 0, a_oData.DataLength(true), SocketFlags.None, new AsyncCallback(SendCallback), this);
            }
            catch (Exception)
            {
                NetworkAction?.NetworkStateChanged(NetworkState.Error, new StateObject(this));
            }
        }