aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs38
1 files changed, 38 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs b/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs
new file mode 100644
index 0000000..423e6be
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs
@@ -0,0 +1,38 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Runtime.Remoting;
5using System.Runtime.Remoting.Channels;
6using System.Runtime.Remoting.Channels.Tcp;
7
8namespace OpenSim.Region.ScriptEngine.RemoteServer
9{
10 class RemoteServer
11 {
12
13 public OpenSim.Grid.ScriptServer.RemotingObject Connect(string hostname, int port)
14 {
15 // Create a channel for communicating w/ the remote object
16 // Notice no port is specified on the client
17 TcpChannel chan = new TcpChannel();
18 ChannelServices.RegisterChannel(chan, true);
19
20 // Create an instance of the remote object
21 OpenSim.Grid.ScriptServer.RemotingObject obj = (OpenSim.Grid.ScriptServer.RemotingObject)Activator.GetObject(
22 typeof(OpenSim.Grid.ScriptServer.RemotingObject),
23 "tcp://" + hostname + ":" + port + "/DotNetEngine");
24
25 // Use the object
26 if (obj.Equals(null))
27 {
28 System.Console.WriteLine("Error: unable to locate server");
29 }
30 else
31 {
32 return obj;
33 }
34 return null;
35
36 }
37 }
38}