Exemple #1
0
        public override bool Send(string data = "")
        {
            if (data == "")
            {
                return(false);
            }

            try
            {
                if (Status)
                {
                    // Begin sending the data to the remote device.
                    TCPClientStream.WriteString(data);
                }
                else
                {
                    Console.WriteLine("The TCP link is not connected.");
                }
                return(true);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("TCP Client Exception on Send: " + e.Message);
                Status = false; // setting the status to false
                return(false);
            }
        }