Quality Interior Design
 
EzTools Software Logo Quality Windows Programming Tools
Because Presentation is Everything
   Access any SQL database through
your webserver with SqlWeb.NET
for .NET, Silverlight and Windows Phone 7
 
Home  Downloads  Buy Support Services About Us

EzComm Messaging COM DLL

 

  Database Products
SqlWeb.NET DLL  
SQLitePlus & SQLite++  
FileDb Simple .NET Database  
  HSP System
Overview  
HTML Scripting Pages  
EzWeb Compiler  
EzWeb Copy Protection  
  ActiveX & .NET Components
EditListView Enhanced ListView  
WOW WebBrowser  
BrowserList HTML Listbox  
HotButton ActiveX  
HotLink HTML HyperLink  
HotList HTML Listbox  
SuperCombo HTML Droplist  
TabStrip ActiveX  
  Other Products
ConfigDb  
RegDb COM DLL  
Zip COM DLL  
EzComm Messaging DLL  
EasyScript.NET  

 

Download EzComm.NET DLL (compiled versions for Silverlight, Windows Phone and .NET)
Download COM DLL version

The EzComm.NET DLL makes it easy to connect two or more computers and begin sending messages between them TCPIP/Sockets. The messages can be anything - text or binary data/files.  The computers can be on the same network or across the Internet anywhere in the world.  Use EzComm in your .NET, Silverlight and Windows Phone programs for any application that needs to send messages or any kind of data, such as ecommerce applications exchanging XML documents or Instant Messaging and Chat programs.

EzComm is sold only as a Source Code Kit

We understand how important it is for the future of your product for you to have complete control over the source code.  That's why we only sell EzComm as source code.  The source code compiles for .NET, Silverlight and Windows Phone, so you can use it on any .NET platform.  The cost is only the amount of 1 days' wages for 1 programmer.  But EzComm is many days work which will save you a lot of time, $ and aggravation.  So the price is well worth it.

What is EzComm and how does it work?

The EzComm.NET DLL is mainly 2 classes which take care of all of the low-level TCPIP/Sockets work for you, making it easy to begin exchanging messages immediately.  There's a lot of work involved in defining and implementing a messaging system. That's what EzComm does for you, providing a turn-key messaging solution which you can easily extend for your own needs.

To use EzComm, you must create a program to act as a server, and another program which connects to the server (client).  Once the connection is made, either side can send a message to the other.

EzComm supports both synchronous and asynchronous connection schemes.  That is, the EzComm ConnectionSvr class can listen and wait for incoming connections while blocking the thread (synchronous) or it can do so non-blocking and fire an event when an incoming connection is made (asynchronous).  In the first case, the code uses a TcpListener object to listen for connections.   Asynchronous mode uses Microsoft's High Performance Socket Architecture.  Likewise, the EzComm Connection class can connect synchronously (blocking) or asynchronously.  Asynchronous mode also uses Microsoft's High Performance Socket Architecture.  The client program creates a Connection object and calls one of the Connect methods to connect to the server.  When the server accepts an incoming connection, it creates a Connection object and passes it back to the containing program.  Now both sides have their own Connection object though which they begin sending and receiving messages.

EzComm can be run on any number of machines - but there is only ever one connection between a single EzComm client and EzComm server instance.  You may want to connect several PCs together.  For example, to implement your own instant messaging program you could have one computer act as the server, and each participating PC connects to this server, which manages all of the connected client connections.  Each time a new client connects to the server, it is added to a list of connections the server maintains.  Your server program would "connect" client PCs with each other, with the server actually routing messages between the connected clients.  There are many different schemes you could use to connect PCs, phones or Silverlight clients together.  See below for sample code.
 

How does it work?

Sample Code

Let's see how easy it is to connect two computers and send messages between them.  First, we create a ConnectionSvr and connect to the OnNewConnection event.  When a new incoming connection is made, this event will be called with a new Connection object.  You need to save this object and connect to its OnMessageReceived event so you will be notified when new messages arrive.  Then you just need to call StartAsync (or WaitForConnection for syncronous mode).

Connection _conn;
ConnectionSvr _connSvr = new ConnectionSvr();

_connSvr.OnNewConnection += new EventHandler<NewConnectionEventArgs>( ConnectionSvr_OnNewConnection );

// now lets begin listening for incoming connections on our IP address
_connSvr.StartAsync( IPAddress.Parse( "127.0.0.1" ), 4533, 10 );

void ConnectionSvr_OnNewConnection( object sender, NewConnectionEventArgs e )
{
    _conn = e.Connection;
    _conn.OnMessageReceived += new EventHandler<NewMessageEventArgs>( Connection_OnMessageReceived );

    // got a new Connection - lets send a message to the other side
   
SendMsg( "We're connected!" );
}

void SendMsg( string msg )
{
    EzComm.Message message = new EzComm.Message();
    message.ID = 1; // Int user defined identifier
    message.Tag = "plain-text-msg"; // string user defined identifier

    // we use a Binary writer to write the message contents to a memory stream
    // then convert it to a byte array
    MemoryStream contentStrm = new MemoryStream();
    BinaryWriter writer = new BinaryWriter( contentStrm );
    writer.Write( msg );
    writer.Close();
    message.Content = contentStrm.ToArray();
    _conn.SendMessage( message );
}

void Connection_OnMessageReceived( object sender, NewMessageEventArgs e )
{
    EzComm.Message message = e.Message;
    MemoryStream contentStrm = new MemoryStream( message.Content );
    BinaryReader reader = new BinaryReader( contentStrm );
    string msg = reader.ReadString();
    Console.WriteLine( msg );
}

As you can see, when an incoming connection is made a new Connection object is created and passed in the OnNewConnection event.  From then on the server communicates through this Connection object.

Now let's write a some client code to connect to this server.  We only need to create a new Connection object and write a few lines of code.   We write two event methods which will be called when a connection is established and when a message is received.

Connection _conn = new Connection();

_conn.OnConnected += new EventHandler<ConnectEventArgs>( Connection_OnConnected );
_conn.OnMessageReceived += new EventHandler<NewMessageEventArgs>( Connection_OnMessageReceived );
_conn.ConnectAsync( IPAddress.Parse( "127.0.0.1" ), PortNum );

void Connection_OnConnected( object sender, ConnectEventArgs e )
{
    // let's send a message to the other side
    SendMsg( "We're connected!" );
}

void SendMsg( string msg )
{
    EzComm.Message message = new EzComm.Message();
    message.ID = 1; // Int user defined identifier
    message.Tag = "plain-text-msg"; // string user defined identifier

    // we use a Binary writer to write the message contents to a memory stream
    // then convert it to a byte array
    MemoryStream contentStrm = new MemoryStream();
    BinaryWriter writer = new BinaryWriter( contentStrm );
    writer.Write( msg );
    writer.Close();
    message.Content = contentStrm.ToArray();
    _conn.SendMessage( message );
}

void Connection_OnMessageReceived( object sender, NewMessageEventArgs e )
{
    EzComm.Message message = e.Message;
    MemoryStream contentStrm = new MemoryStream( message.Content );
    BinaryReader reader = new BinaryReader( contentStrm );
    string msg = reader.ReadString();
    Console.WriteLine( msg );
}

The Message object's Content property is a Byte array which can contain any data.  You don't need to use the BinaryWriter/MemoryStream method.  For example, you could open a file and read the contents as a Byte array and assign this directly to the Message.Content and send it.  Since you have the source code, you can extend these classes any way you may need to accomplish your goals.



 

Copyright © EzTools Software2001-2010 All rights reserved. Trademarks and Disclaimer:
All trademarks belong to their respective companies.