/// <summary>
        /// A connection to our server, always listening asynchronously.
        /// </summary>
        /// <param name="socket">The Socket for the connection.</param>
        /// <param name="args">The SocketAsyncEventArgs for asyncronous recieves.</param>
        /// <param name="dataReceived">A callback invoked when data is recieved.</param>
        /// <param name="disconnectedCallback">A callback invoked on disconnection.</param>
        public ServerConnection(Socket socket, SocketAsyncEventArgs args, DataReceivedCallback dataReceived,
            DisconnectedCallback disconnectedCallback)
        {
            logger = new ElibLogging("data");
            this.AuthorizationType = AuthorizationType.Anonymous;
            lock (this)
            {
                var remotIP = socket.RemoteEndPoint as IPEndPoint;
                var localIP = socket.LocalEndPoint as IPEndPoint;
                State state = new State()
                {
                    socket = socket,
                    dataReceived = dataReceived,
                    disconnectedCallback = disconnectedCallback,
                    Device = new Device()
                    {
                        RemoteIP = remotIP.Address.ToString(),
                        LocalIP = localIP.Address.ToString()
                    }
                };

                eventArgs = args;
                eventArgs.Completed += ReceivedCompleted;
                eventArgs.UserToken = state;

                ListenForData(eventArgs);
            }
        }
Example #2
0
 public AgentRecord(Guid id, string file, string args)
 {
     this.Id = id;
     this.File = file;
     this.Arguments = args;
     logger = new ElibLogging("app");
 }
Example #3
0
 public StoreProcessor(int index)
 {
     this.index = index;
     logger = new ElibLogging("trace");
     _service = GetService();
     this.DateTime = DateTime.Now;
     Items = new List<CurrencyInfo>();
     MAX_LENGTH = Math.Max(CurrencyStoreSection.Instance.Task.PoolSize, 10);
     storaged = CurrencyStoreSection.Instance.Task.Storage.Enable;
 }
Example #4
0
 static Message()
 {
     logger = new ElibLogging("trace");
 }