Erlang / C# The Best Interface

Gilberio Carmenates García <>
Tue Jan 18 18:05:47 CET 2011


Hi all!!!

There are any body here who really like C#!, and who want to do some stuffs
combining this two wonderful technologies?

 

** New ExtendedVisualOtp release 1.6. **

 

All you dream as impossible is now possible.

1-      Multiple server connections from the same client.

2-      Real-time message passing (obviously thx to Erlang) between the C#
client and Erlang server.

3-      Request abort feature (a request aborted in the client, abort its
resolver process in the server).

4-      Multiple Sync and Async request at the same time to different
servers form the same client.

5-      Unknown Incoming messages treating in the client (the server can
send massive messages to all the connected clients, useful for games server
and chats),

only using a little function like send_to_all(Description, Message) or
send_to_others(Description, Message, ExceptionPid).

6-      Other features like Abort a waiting for a reply request from another
threat. A server disconnection makes all Waiting Requests to release and
return null.

7-      You can send objects of any kind to the server and to be received in
other clients (like classes, images etc.)

8-      You can make Sync requests without any fear of getting locks because
if the answer for the request arrives before you call the WaitForReply
function this function will throw an Error telling you that the request was
already answered an received through the OnReceive Event of the async way.

Example:

IRequestInfo reqinfo = requestHanlder.Request(“Hola mundo”);

Thread.Sleep(1000);   // if the answer arrives before, through the OnReceive
event because this fool! Then the next sentence will throw an error

reqinfo.WaitForReply();  or reqinfo.WaitForReply(5000);

 

You will never get locks using Sync requests. And if you are not sure use a
timeout.

The same way you can abort the request using reqinfo object:
reqinfo.AbortRequest(); or know if the request was already answered or made
using its properties.

You can do many stuffs using IServerReply and IRequestInfo objects, example:
using IServerReply object you can use a property to convert the Erlang terms
to CSharp terms and vice versa. 

 

9-      You can program clients as server-client model of the most easy way
(only if you don’t want to write any code in Erlang, just in C#) you can
configure de clients

and the server to act as intermediary between the clients of so easy way.
Using the informing message that send the server to all the clients when a
new client is connected or disconnected, sending if you want, its pid to all
the other clients, then you can get that pid to send a message using the
server as intermediary “directly” to that other client or register that
client in the server as a server prototype, this make possible to program
the client-server model with the clients without write any line of code in
Erlang. The automatic replier that brings with the framework
ExtendedVisualOtp in the server part do all the dirty work for you.

10-   You can send whatever you have been programming to your friends who
are programming under ExtendedVisualOtp so, with a simple call to the
function 

PublishClientImage(); of the ErlangServerRequest class. Then your program
image in runtime it will be executed at the machines of your friends who are
connected to the 

server so. Then if you are developing a chat, you can send the image of your
program while your friend is programming other chat or program and see your
creation, at the 

same time he can send to you his creation.

 

The most powerful interface between languages ever known ExtendedVisualOtp.
That and so much more EVO Release 1.6

 

Little examples:

 


the C# part:

erlangServerInterface1.Connect();

erlangServerRequest1.Request(new object[] {“’insert_person’”, “Ivan”, 26,
“Male”});

 


the Erlang part:

{’insert_person’”, Name, Age, Sex}, Pid, RequestInfo}->

    
.

    Pid ! {reply, ‘inserted_ok’, RequestInfo};    %% if you want to answer
to the client who made the request.

 

 

To receive the answer in the client

 

If you use the sync way, add .WaitForReply().CSharpReply
    at the end of
the request line before


 

And if you want the async way just use the OnReceive event

 

OnReceiveEvent..(IServerReply _reply)

{

        If (_reply.Description == “insert_person”) {

                MessageBox.Show(_reply.CSharpReply as string);

        }

}

 

As simple like it seems and powerful as it could not seems.

 

 

 

 

 

----------------------------------------------------------------------------
---------------------------------

Ing: Ivan Carmenates García

Current project: ExtendedVisualOtp and Erlang Book: "Erlang Avanzado para
principiantes"

Ivanco Software Company in association with SPI Team

spi_red32LogoSPI

 

 

 



=======================================================================
Este mensaje ha sido enviado mediante el servicio de correo electrónico que ofrece la Federación de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organización y su política informativa. La persona que envía este correo asume el compromiso de  usar el servicio a tales fines y cumplir con las regulaciones establecidas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110118/6c88287c/attachment.htm>


More information about the erlang-questions mailing list