aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Servers/OpenGridProtocol.cs
diff options
context:
space:
mode:
authorgareth2007-04-22 04:50:58 +0000
committergareth2007-04-22 04:50:58 +0000
commitb8c742b9328a4caacadb6ea858f2574e814830cc (patch)
treee75914dea56c432f9be14e604cd240a03a88cd69 /OpenSim.Servers/OpenGridProtocol.cs
parentBumped avatar entry height to 15m above ground rather than the old 1m above g... (diff)
downloadopensim-SC_OLD-b8c742b9328a4caacadb6ea858f2574e814830cc.zip
opensim-SC_OLD-b8c742b9328a4caacadb6ea858f2574e814830cc.tar.gz
opensim-SC_OLD-b8c742b9328a4caacadb6ea858f2574e814830cc.tar.bz2
opensim-SC_OLD-b8c742b9328a4caacadb6ea858f2574e814830cc.tar.xz
Added some more good stuff to the new TCP skeleton
Diffstat (limited to '')
-rw-r--r--OpenSim.Servers/OpenGridProtocol.cs24
1 files changed, 17 insertions, 7 deletions
diff --git a/OpenSim.Servers/OpenGridProtocol.cs b/OpenSim.Servers/OpenGridProtocol.cs
index 8c91b9a..e3a7c3f 100644
--- a/OpenSim.Servers/OpenGridProtocol.cs
+++ b/OpenSim.Servers/OpenGridProtocol.cs
@@ -14,15 +14,17 @@ namespace OpenSim.Servers
14 { 14 {
15 15
16 private Thread m_workerThread; 16 private Thread m_workerThread;
17 private TcpListener m_tcpListener; 17 private Socket m_listenerSocket;
18 private IPEndPoint m_IPendpoint;
19
18 private int m_port; 20 private int m_port;
19 private ArrayList m_clients; 21 private ArrayList m_clients;
20 22
21 private class ClientHandler { 23 private class ClientHandler {
22 private Thread m_clientThread; 24 private Thread m_clientThread;
23 private TcpClient m_socketHandle; 25 private Socket m_socketHandle;
24 26
25 public ClientHandler(TcpClient clientSocketHandle) { 27 public ClientHandler(Socket clientSocketHandle) {
26 m_socketHandle=clientSocketHandle; 28 m_socketHandle=clientSocketHandle;
27 m_clientThread = new Thread(new ThreadStart(DoWork)); 29 m_clientThread = new Thread(new ThreadStart(DoWork));
28 m_clientThread.IsBackground = true; 30 m_clientThread.IsBackground = true;
@@ -31,6 +33,12 @@ namespace OpenSim.Servers
31 33
32 private void DoWork() { 34 private void DoWork() {
33 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: ClientHandler.DoWork() - Got new client"); 35 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: ClientHandler.DoWork() - Got new client");
36
37 }
38
39 private void WriteLine(string theline) {
40 byte[] thelinebuffer = System.Text.Encoding.ASCII.GetBytes(theline.ToCharArray());
41 m_socketHandle.Send(thelinebuffer,theline.Length,0);
34 } 42 }
35 } 43 }
36 44
@@ -55,13 +63,15 @@ namespace OpenSim.Servers
55 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: StartServerSocket() - Spawned main thread OK"); 63 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: StartServerSocket() - Spawned main thread OK");
56 64
57 65
58 m_tcpListener = new TcpListener(m_port); 66 m_IPendpoint = new IPEndPoint(IPAddress.Any, m_port);
59 m_tcpListener.Start(); 67 m_listenerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
68 m_listenerSocket.Bind(m_IPendpoint);
69 m_listenerSocket.Listen(4);
60 70
61 TcpClient sockethandle; 71 Socket sockethandle;
62 while (true) 72 while (true)
63 { 73 {
64 sockethandle = m_tcpListener.AcceptTcpClient(); 74 sockethandle = m_listenerSocket.Accept();
65 m_clients.Add(new OpenGridProtocolServer.ClientHandler(sockethandle)); 75 m_clients.Add(new OpenGridProtocolServer.ClientHandler(sockethandle));
66 } 76 }
67 } 77 }