//methods
        public void Connect(bool callbackmode = false)
        {
            IsConnected = false;

            //Read keyword
            List <string> keyword;

            try
            {
                keyword = GetKeywords();
            }
            catch (Exception e)
            {
                throw new StarsException("Could not open keyword file.: " + e.Message);
            }

            //Establish TCP/IP Socket
            try
            {
                IPAddress[] ipAddress = Dns.GetHostAddresses(ServerHostname);
                var         remoteEP  = new IPEndPoint(ipAddress[0], ServerPort);
                sock = new Socket(remoteEP.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                sock.Connect(remoteEP);
            }
            catch (Exception e)
            {
                throw new StarsException("Could not establish TCP/IP connection.: " + e.Message);
            }

            //Get random number.
            var mes = Receive().from;
            int rNum;

            if (!int.TryParse(mes, out rNum))
            {
                throw new StarsException("Could not establish TCP/IP connection.: " + mes);
            }

            //Get keyword and send to STARS server.
            tcpSendString($"{NodeName} {keyword[(rNum % keyword.Count)]}");
            StarsMessage rdBuf = Receive();

            if (rdBuf.command != "Ok:")
            {
                throw new StarsException("Could not connect to server.: " + rdBuf.Message);
            }

            //set event
            if (callbackmode)
            {
                CallbackOn();
            }

            IsConnected = true;
        }
 public StarsCbArgs(StarsMessage starsmessage)
 {
     STARS = starsmessage;
 }
 public StarsCbArgs(string from, string to, string command, string parameters)
 {
     STARS = new StarsMessage(from, to, command, parameters);
 }