From 1dfda8f7440122486a51f5353807571160106656 Mon Sep 17 00:00:00 2001
From: gareth
Date: Sat, 21 Apr 2007 17:36:03 +0000
Subject: Added OpenGridProtocol class - start of the new TCP-based intersim
protocol, very basic skeleton First commit since we lost JesseMalt -
Dedicated to their memory
---
OpenSim.Servers/OpenGridProtocol.cs | 74 +++++++++++++++++++++++
OpenSim.Servers/OpenSim.Servers.dll.build | 99 ++++++++++++++++---------------
2 files changed, 124 insertions(+), 49 deletions(-)
create mode 100644 OpenSim.Servers/OpenGridProtocol.cs
(limited to 'OpenSim.Servers')
diff --git a/OpenSim.Servers/OpenGridProtocol.cs b/OpenSim.Servers/OpenGridProtocol.cs
new file mode 100644
index 0000000..8c91b9a
--- /dev/null
+++ b/OpenSim.Servers/OpenGridProtocol.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+using Nwc.XmlRpc;
+using System.Collections;
+
+namespace OpenSim.Servers
+{
+ public class OpenGridProtocolServer
+ {
+
+ private Thread m_workerThread;
+ private TcpListener m_tcpListener;
+ private int m_port;
+ private ArrayList m_clients;
+
+ private class ClientHandler {
+ private Thread m_clientThread;
+ private TcpClient m_socketHandle;
+
+ public ClientHandler(TcpClient clientSocketHandle) {
+ m_socketHandle=clientSocketHandle;
+ m_clientThread = new Thread(new ThreadStart(DoWork));
+ m_clientThread.IsBackground = true;
+ m_clientThread.Start();
+ }
+
+ private void DoWork() {
+ OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: ClientHandler.DoWork() - Got new client");
+ }
+ }
+
+ public OpenGridProtocolServer(int port)
+ {
+ m_port = port;
+ }
+
+ public void Start()
+ {
+ OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: Start() - Opening server socket");
+
+ m_workerThread = new Thread(new ThreadStart(StartServerSocket));
+ m_workerThread.IsBackground = true;
+ m_workerThread.Start();
+ }
+
+ private void StartServerSocket()
+ {
+ try
+ {
+ OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: StartServerSocket() - Spawned main thread OK");
+
+
+ m_tcpListener = new TcpListener(m_port);
+ m_tcpListener.Start();
+
+ TcpClient sockethandle;
+ while (true)
+ {
+ sockethandle = m_tcpListener.AcceptTcpClient();
+ m_clients.Add(new OpenGridProtocolServer.ClientHandler(sockethandle));
+ }
+ }
+ catch (Exception e)
+ {
+ OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.Message);
+ }
+ }
+ }
+}
diff --git a/OpenSim.Servers/OpenSim.Servers.dll.build b/OpenSim.Servers/OpenSim.Servers.dll.build
index 278018d..ee52a56 100644
--- a/OpenSim.Servers/OpenSim.Servers.dll.build
+++ b/OpenSim.Servers/OpenSim.Servers.dll.build
@@ -1,49 +1,50 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--
cgit v1.1