Inter Process Communication/Remoting library

agraham

Expert
Licensed User
Longtime User
At last I have managed to come up with a dead easy to use inter process communication library. This awesome (if only you knew what was going on behind the scenes) library lets one Basic4ppc client application call the Subs of another Basic4ppc server application on the same computer, over a network or even over the Internet!

It is based on two technologies. The .NET Remoting facility that is built in to the .NET Framework and the Caller code from my Basic4ppc debug suite http://www.b4x.com/forum/additional...-legacy-optimised-applications.html#post27120

Unfortunately this will only work on the desktop as the Compact Framework does not support Remoting although there are a couple of third-party implementations that I may investigate - cost permitting.

As usual library, source, help and deceptively simple demo applications are included.

EDIT: As a clarification. An application is not restricted to a single RemoteObject. So, for example, a pair of comunicating apps could each have two RemoteObjects on different ports and with different remote service names, one a client to the other app and one a server to it. This would enable two-way calling of each others Subs. Things could get a bit confusing though if you aren't careful!

EDIT:- Version 1.1 now posted includes a RemotingCF library that will work on devices and between desktops and devices. See post #10 for details.

EDIT:- Version 2.0 for Basic4ppc v6.90 and later now posted. See post #13 for details.
 

Attachments

  • Remoting1.1.zip
    41.7 KB · Views: 173
  • Remoting2.0.zip
    43 KB · Views: 136
Last edited:

derez

Expert
Licensed User
Longtime User
Andrew
This is beautiful, and I don't want to know what is going on behind the scenes...

I see a mountain of games for two players, using exactly the same code, where each player does his move on his application and his opponents application, without messages.

Thanks :sign0060:
 

derez

Expert
Licensed User
Longtime User
Andrew
Playing with this library, I managed to connect on my home lan, using TCP and the host name, but not when using the host internal IP :

This works - Remote.connect("Tcp" , "main" , 51234 , "Remote")
and this doesn't - Remote.connect("Tcp" , "192.168.0.167" , 51234 , "Remote")

In the second case I get this error:

"Remote.CallGuiSub("Launch",par())
Error description:
Server encountered an internal error. For more information, turn off customerrors in the server's.config file"

What am I doing wrong ?
 
Last edited:

agraham

Expert
Licensed User
Longtime User
and this doesn't - Remote.connect("Tcp" , "192.168.0.167" , 51234 , "Remote")
At the moment it only accepts host names not IP addresses, the next version will.

In the second case I get this error ... What am I doing wrong ?
I'm afraid that I don't know! Is that on the client or server? Is it locally or over the network. If it works if you call that on the server oor locally on the client it will most likely be a network problem of some sort.
 

derez

Expert
Licensed User
Longtime User
At the moment it only accepts host names not IP addresses, the next version will.

I followed the help file which says:
The hostname is only used by the client to locate the computer where the server is located and may be a dotted quad IP address or the domain name of the computer

This explains the problem, Thank you.
 

agraham

Expert
Licensed User
Longtime User
Version 1.1 includes a RemotingCF library that will work on devices as well as desktop. It uses a home grown (i.e.crude!) remoting layer based on TCP. Details in the help.

It is now an error to call an Async method while another is pending and an Exception is thrown if this is attempted.

Dotted quad IP addresses as well as hostnames may now be used.

Async data calls are now provided and all Async calls have a tag parameter that may be retrieved in the AsyncEvent and used to identify what to do.

A sample application for RemotingCF is provided to show that two way calling is possible.

Enjoy :).
 

Zenerdiode

Active Member
Licensed User
Hello Andrew,

I'm getting an error when trying to invoke the New1 method for the desktop version.

Is there an update required for this library for Version 6.90?
Do I have some .Net assemblies missing?

I'm trying the demo you provided.

Christopher.
 

agraham

Expert
Licensed User
Longtime User
Version 2.0 now posted will to work with Basic4ppc version 6.90 or later. Version 1.1 remains posted to work with earlier versions of Basic4ppc. Owing to the stricter typing of Basic4ppc the data to be transferred must be an array of Strings of rank 3 three or less.

I actually made and tested these changes during the development of Basic4ppc v6.90 but overlooked releasing them. It was all fresh in my mind then but I'm a bit rusty about how it all works now - so I've just packaged it all up and hope I got it all right back then!
 

Zenerdiode

Active Member
Licensed User
Hello Andrew,

I am looking to use the Remoting librry so two processes may communicate on the Desktop. I'm getting the following error when I'm trying to compile for desktop. Would you have a look for me please? As soon as I have even an empty project with a RemoteObject - it fails on compilation.

WinXP SP3
.Net 2.0

Many Thanks,

Christopher
 

Attachments

  • CS0234 Error.jpg
    CS0234 Error.jpg
    14.3 KB · Views: 7

agraham

Expert
Licensed User
Longtime User
I am a bit rusty on Basic4ppc so it took a couple of minutes for the penny to drop. I guess you are trying to merge the library source. If you remove Remoting.cs from the Libraries folder it should compile OK. Also adding the following line to the LibrariesExceptions.txt file in the Basic4ppc Desktop folder will allow merging.

B4X:
3:Remoting.dll:System.Runtime.Remoting.dll
 

Zenerdiode

Active Member
Licensed User
Many thanks for your quick response - I appreciate you are a bit more busy with the Android stuff nowadays. I opted for the latter as I prefer to merge the libraries where I can.

All working now. :)
 

agraham

Expert
Licensed User
Longtime User
I appreciate you are a bit more busy with the Android stuff nowadays.
Actually I've gone back to playing with Basic4ppc on the desktop only as I've got fed up with the Ads and Games mentality that suffuses Android programmers and users.

I hope he won't mind me mentioning it but Erel has let me play with the source code of Basic4ppc for my own use so I'm building myself a desktop only IDE incorporating FormExDesktop as the intrinsic Form. I can't compile for devices any more as I've changed my main computer and laptops over to Windows 7 and didn't want to intall VS2005 as well as VS2010 but that is of little practical signficance now.
 
Top