Example #1
0
        static void Main(string[] args)
        {
            CommunicatorOptions co = new CommunicatorOptions();

            co.password = "******";

            Communicator communicator = new Communicator(co);

            communicator.SetDefaultReceiver("127.0.0.1", 1234);

            Message msg = new Message();

            OperatingSystem os_info = System.Environment.OSVersion;

            msg.lang        = "C#";
            msg.langversion = Environment.Version.ToString();
            msg.os          = "Windows " + GetOsName(os_info);
            msg.osversion   = os_info.VersionString;

            msg.msg = "Hello! ;)";

            msg.senderimg = File.ReadAllBytes("logo image\\c# logo.png");;

            communicator.Send(msg, "TestMessage");

            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            CommunicatorOptions co = new CommunicatorOptions();

            co.password = "******";

            Communicator communicator = new Communicator(co);

            communicator.listen(1234);

            communicator.On("TestMessage", data => {
                Message msg = new Message();

                CommunicatorTools.CopyToObject(msg, data);


                Console.WriteLine("A program from " + msg.lang + " " + msg.langversion + " on " + msg.os + " " + msg.osversion + " connected");

                File.WriteAllBytes("ReceivedImage.png", msg.senderimg);

                Console.WriteLine("An image was received and saved to: ReceivedImage.png");

                Console.WriteLine("Received a message:");

                Console.WriteLine(msg.msg);
            });

            Console.ReadKey();
        }
Example #3
0
 public Communicator(CommunicatorOptions co)
 {
     options = co;
 }