C# Comm Prototype

message-passing infrastructure

Fig 1. Communication Channels
Fig 2. MsgPassingComm Classes

1.0 Concept

This repository provides a prototype message-passing communication channel using Windows Communication Foundation (WCF). Messages are similar to HTTP messages in that they have a header with a series of ASCII lines that define commands and attributes, including a content-length attribute. If that exists and has a value greater than zero the value indicates the number of bytes contained in the message body. That is used, by this channel to send file blocks. Each channel is one-way. Senders post a message, via the channel, to the receiver's receive queue. The channel is asynchronous, meaning that sender's don't wait for a reply - not even an acknowledgement.

2.0 Design

All messages are expected to contain attributes { to: "endpoint" } and { from: "endpoint" } indicating the source and destination endpoints, where an endpoint is a value "url:port". The "to" endpoint allows a channel user to supply a message, letting a send thread connect, if not already connected, to the intended receiver. The "from" endpoint allows the receiver to eventually reply, if appropriate, e.g., with a requested entity. Note that this channel is asynchronous. Senders do not wait for a reply. They simply post messages and a dedicated receive thread extracts incoming messages from a receive queue. If the message contains an attribute { sending-file: "filename" } the channel attempts to send the named file in blocks to the receiver.

3.0 Build

All code was built with Visual Studio, Community Edition - 2019, and tested on Windows 10.

4.0 Note

The top two tiers of Fig 2. are accurate, but the bottom tier is implemented with WCF services, which use sockets as a private resource. Conceptually it matches the code, but should show the WCF classes. I will eventually update this diagram to match the existing code.

4.0 Resources

MessagePassing Blog
AsynchSys.pdf