public dynamic Create(NetworkData a_oNetData)
        {
            if ((a_oNetData?.DataLength() ?? 0) < 1)
                throw new NetworkDataBufferIsEmpty("Dane telegramu");

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

            return Create(_oByteData);
        }
Beispiel #2
0
        public virtual void AsyncSend(NetworkData a_oData)
        {
            try
            {
                NetworkAction?.StateChanged(State.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?.StateChanged(State.Error, new StateObject(this));
            }
        }