Download Latest Version SeelWorks.InterCom.zip (19.4 kB)
Email in envelope

Get an email when there's a new version of SeelWorks.InterCom

Home
Name Modified Size InfoDownloads / Week
readme.txt 2017-02-24 1.9 kB
SeelWorks.InterCom.zip 2017-02-24 19.4 kB
SeelWorks.InterComTester.zip 2017-02-19 79.0 kB
Totals: 3 Items   100.4 kB 0
Updated Feb 24, 2017:
 - Fixed numerous bugs and typos (mainly with ByteBuffer)
 - Streamlined certain processes


Documentation is forthcoming.

But basically it works like this...

In the main window of the client process...

...
using SeelWorks.InterCom;

namespace MyClientApp {

   public partial class MyWindow :Form {
      public MyWindow() {
         InitializeComponent();
      }

      private void MyButton_Click(object sender, EventArgs e) {
         try {
            MessageBox.Show(this, Client.SendAndReceive("MyPipeServer", ByteBuffer.FromValues("GetTime")).ReadString(), "Reponse");
         } catch(Exception ex) {
            MessageBox.Show(this, ex.Message, ex.Source);
         }
      }
   }

}


In the main window of the server process...

...
using SeelWorks.InterCom;

namespace MyServerApp {

   public partial class MyWindow :Form {
      private Server _server = new Server("MyPipeServer");

      public MyWindow() {
         InitializeComponent();
         _server.DataReceived += _server_DataReceived;
         _server.Start(10);
      }

      private void MyWindow_FormClosing(object sender, FormClosingEventArgs e) {
         _server.Stop();
      }
   
      private void _server_DataReceived(object sender, Server.DataReceivedEventArgs e) {
         if(InvokeRequired) {
            Invoke((Server.DataReceivedEventHandler)_server_DataReceived, sender, e);
         } else {
            switch(e.BufferIn.ReadString()) {
               case "GetDate":
                  e.BufferOut.Write(DateTime.Now.ToShortDateString());
                  break;
               case "GetTime":
                  e.BufferOut.Write(DateTime.Now.ToShortTimeString());
                  break;
               default:
                  e.BufferOut.Write("Your request is unrecognized.");
                  break;
            }
         }
      }
   }

}
Source: readme.txt, updated 2017-02-24