Example #1
0
        private void InitializeClient()
        {
            MonitoringInitializationMessage queueItems = new MonitoringInitializationMessage(MockQueueItems.items.Values.ToList(), HeartBeatPublisher.ipAddress.ToString(), HeartBeatPublisher.Port);

            clientState = PublisherClientState.Initializing;


            // make use of concurrent bag
            SendAsync(queueItems);
        }
Example #2
0
        private void InitializationCallback(IAsyncResult result)
        {
            if (result.IsCompleted)
            {
                //Socket client = (Socket)result.AsyncState;
                StateObject state     = (StateObject)result.AsyncState;
                int         bytesSent = state.workSocket.EndSend(result);

                if (itemsChangedInInitialization.Count > 0)
                {
                    List <QueueItemStateChangeMessage> messagesList = itemsChangedInInitialization.ToList();
                    SendAsync(new ChangedItemsWhileInitializingMessage()
                    {
                        items = messagesList
                    });
                }

                clientState = PublisherClientState.Connected;
            }
            else
            {
                throw new Exception();
            }
        }
Example #3
0
 public void Close()
 {
     clientState = PublisherClientState.Disconnected;
     clientSocket.Close();
 }