From 6055db2bc3beadcfd3e06c74b0fffb42ae4545a7 Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Sun, 30 Dec 2007 22:37:07 +0000 Subject: server->script event path almost ready for remote scriptengine (translation table between local script ID and remote script ID missing) --- OpenSim/Grid/ScriptServer/RemotingObject.cs | 24 ++++++++++++++++++++++++ OpenSim/Grid/ScriptServer/RemotingServer.cs | 28 ++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 OpenSim/Grid/ScriptServer/RemotingObject.cs create mode 100644 OpenSim/Grid/ScriptServer/RemotingServer.cs (limited to 'OpenSim/Grid/ScriptServer') diff --git a/OpenSim/Grid/ScriptServer/RemotingObject.cs b/OpenSim/Grid/ScriptServer/RemotingObject.cs new file mode 100644 index 0000000..f095ca4 --- /dev/null +++ b/OpenSim/Grid/ScriptServer/RemotingObject.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Region.Environment.Interfaces; + +namespace OpenSim.Grid.ScriptServer +{ + public class RemotingObject : MarshalByRefObject + { + // This object will be exposed over remoting. It is a singleton, so it exists only in as one instance. + + // Expose ScriptEngine + public OpenSim.Region.ScriptEngine.DotNetEngine.ScriptEngine ScriptEngine = new OpenSim.Region.ScriptEngine.DotNetEngine.ScriptEngine(); + + /// + /// Receives calls from remote grids. + /// + /// + public OpenSim.Region.ScriptEngine.DotNetEngine.ScriptEngine GetScriptEngine() + { + return ScriptEngine; + } + } +} diff --git a/OpenSim/Grid/ScriptServer/RemotingServer.cs b/OpenSim/Grid/ScriptServer/RemotingServer.cs new file mode 100644 index 0000000..3ec3e64 --- /dev/null +++ b/OpenSim/Grid/ScriptServer/RemotingServer.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.Remoting; +using System.Runtime.Remoting.Channels; +using System.Runtime.Remoting.Channels.Tcp; + + +namespace OpenSim.Grid.ScriptServer +{ + class RemotingServer + { + + public void CreateServer(int port, string instanceName) + { + // Create an instance of a channel + TcpChannel channel = new TcpChannel(port); + ChannelServices.RegisterChannel(channel, true); + + // Register as an available service with the name HelloWorld + RemotingConfiguration.RegisterWellKnownServiceType( + typeof(RemotingObject), + instanceName, + WellKnownObjectMode.Singleton); + + } + } +} -- cgit v1.1