Exemplo n.º 1
0
 public NetworkService(ModeEnum a_eMode, int a_iBufferSize = BUFFER_SIZE)
 {
     Identifier       = GetHashCode().ToString("X8");
     Mode             = a_eMode;
     Data             = new NetworkData(a_iBufferSize);
     NetworkAction    = null;
     RegisteredServer = null;
 }
Exemplo n.º 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));
            }
        }