Lightweight but comprehensive framework for interprocess communication.
- Android: How to communicate with .NET application via TCP
- Remote Procedure Calls between Android and .NET
- Android: Fast Communication with .NET Using Protocol Buffers
- Android: How to Receive Notification Messages from Multiple .NET Applications via Websockets
Features provided by the framework:
Supported Communication Protocols and Transportation Mechanisms
To connect applications, the framework supports following protocols and transportation mechanisms:
- TCP - for communication between applications running on different machines.
- Websockets - for communication between applications running on different machines. It provides bi-directional, full-duplex communication in environments which block non-standard Internet connections using a firewall.
- HTTP - for communication between applications running on different machines. It works in environments blocking non-standard Internet connections using a firewall.
- UDP - for communication between applications running on different machines. Short and fast messages. Delivery of packets is not guaranteed.
- Shared Memory - for very fast communication between applications running on the same machine.
- Named Pipes - for communication between applications running on the same machine.
- Android USB Cable - for communication between computer and Android device connected via the USB cable.
- Thread Messaging - for communication between threads running in the same process.
Serialization of Messages
Communicated messages can be serialized/deserialized with:
- XML Serializer - serialization to XML.
- Xml Data Contract Serializer - for serialization to XML using DataContract and DataMember attributes.
- Json Data Contract Serializer - for serialization to JSON using DataContract and DataMember attributes.
- Binary Serializer - for fast serialization using the binary format (does not work for the communication between .NET and Java).
- AES Serializer - for encrypting using Advanced Encryption Standard.
- Rijndael Serializer - for encrypting using Rijndael encryption.
- GZip Serializer - for compressing big messages before sending across the network.
- RSA Serializer - for encrypting messages by RSA algorithm using public and private keys.
- RSA Digitally Signing Serializer - for using digital signature to verify who sent the message and that the message was not changed.
The communication API is not bound to a particular protocol or encoding format, therefore your implementation is same, does not matter what you use.
To implement the communication between applications, the framework provides functionality to send and receive messages. Communication can be one-way or request-response and messages can be:
- String Messages - for sending and receiving text messages.
- Typed Messages - for sending and receiving data structures of specified types.
- RPC (Remote Procedure Calls) - for invoking methods or subscribing events in another application.
RPC works across platforms! It means you can make the RPC communication between C# and Java code.
Components that can be placed on the communication path to control the routing behavior.
- Message Bus - for publishing multiple services from one place.
- Broker - for publish-subscribe scenarios (publisher sends messages to the broker and the broker notifies all subscribers).
- Router - for re-routing messages to a different address.
- Backup Router - for re-routing messages to a backup service if the service is not available.
- Dispatcher - for routing messages to all connected receivers (e.g. for a service listening to TCP and HTTP at the same time).
- Load Balancer - for distributing workload across multiple computers.
- Channel Wrapper/Unwrapper - for receiving multiple types of messages on one address (no need for if ... else ... statement in the user code)
The communication across the network is typically less reliable as a local call inside a process. The network connection can be interrupted or a receiving application can be temporarily unavailable. If your communication scenario requires overcome these issues, the framework provides:
- Monitoring of connection availability - for early detection of a disconnection.
- Buffered messaging and automatic reconnect - for overcoming short disconnections (e.g. in case of unstable network).
The communication across the network is easy to observe and confidential data can be acquired by unauthorized persons. Therefore, you may want to protect your data:
- Authenticated Connection - for verifying the identity of clients connecting to the service.
- Encrypted Messages - AES or RSA serializers.
- Digitaly Signed Messages - for protecting authenticity and message integrity.
- SSL/TLS - for secured communication.