From cd6f4a57e7586ffd5c6dae91633e61e293272def Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Tue, 4 Mar 2008 04:11:37 +0000 Subject: Added copyright heaaders. Minor cleanup. --- OpenSim/Region/ScriptEngine/Common/TRPC/TCPClient.cs | 18 ++++-------------- OpenSim/Region/ScriptEngine/Common/TRPC/TCPCommon.cs | 8 ++++---- OpenSim/Region/ScriptEngine/Common/TRPC/TCPServer.cs | 8 ++------ OpenSim/Region/ScriptEngine/Common/TRPC/TCPSocket.cs | 8 +++----- 4 files changed, 13 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Common/TRPC') diff --git a/OpenSim/Region/ScriptEngine/Common/TRPC/TCPClient.cs b/OpenSim/Region/ScriptEngine/Common/TRPC/TCPClient.cs index 1fd7a25..236b685 100644 --- a/OpenSim/Region/ScriptEngine/Common/TRPC/TCPClient.cs +++ b/OpenSim/Region/ScriptEngine/Common/TRPC/TCPClient.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -37,21 +37,19 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC { public class TCPClient : TCPCommon.ClientInterface { - public TCPClient() { } + private readonly Dictionary Clients = new Dictionary(); private int ClientCount = 0; - public event TCPCommon.ClientConnectedDelegate ClientConnected; public event TCPCommon.DataReceivedDelegate DataReceived; public event TCPCommon.DataSentDelegate DataSent; public event TCPCommon.CloseDelegate Close; public event TCPCommon.ConnectErrorDelegate ConnectError; - /// /// Creates client connection /// @@ -62,6 +60,7 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC //newsock.BeginConnect(ipe, new AsyncCallback(asyncConnected), newsock); newsock.Connect(ipe); } + public int ConnectAndReturnID(string RemoteHost, int RemotePort) { Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); @@ -71,7 +70,6 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC return ProcessConnection(newsock); } - public void Disconnect(int ID) { Clients[ID].Disconnect(); @@ -88,9 +86,6 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC { try { - - - int id = ClientCount++; TCPSocket S = new TCPSocket(id, client); @@ -121,9 +116,6 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC return -1; } - - - void S_DataSent(int ID, int length) { if (DataSent != null) @@ -147,7 +139,5 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC { Clients[clientID].Send(clientID, data, offset, len); } - - } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/Common/TRPC/TCPCommon.cs b/OpenSim/Region/ScriptEngine/Common/TRPC/TCPCommon.cs index f3a55ba..c0e402a 100644 --- a/OpenSim/Region/ScriptEngine/Common/TRPC/TCPCommon.cs +++ b/OpenSim/Region/ScriptEngine/Common/TRPC/TCPCommon.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -36,7 +36,6 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC public delegate void CloseDelegate(int ID); public delegate void ConnectErrorDelegate(string Reason); - public interface ServerAndClientInterface { void Send(int clientID, byte[] data, int offset, int len); @@ -45,17 +44,18 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC event DataSentDelegate DataSent; event CloseDelegate Close; } + public interface ClientInterface : ServerAndClientInterface { event TCPCommon.ConnectErrorDelegate ConnectError; void Connect(string RemoteHost, int RemotePort); void Disconnect(int ID); } + public interface ServerInterface : ServerAndClientInterface { void StartListen(); void StopListen(); } - } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/Common/TRPC/TCPServer.cs b/OpenSim/Region/ScriptEngine/Common/TRPC/TCPServer.cs index da16da8..b1e6a82 100644 --- a/OpenSim/Region/ScriptEngine/Common/TRPC/TCPServer.cs +++ b/OpenSim/Region/ScriptEngine/Common/TRPC/TCPServer.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -68,7 +68,6 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC private readonly Dictionary Clients = new Dictionary(); private int ClientCount = 0; - public event TCPCommon.ClientConnectedDelegate ClientConnected; public event TCPCommon.DataReceivedDelegate DataReceived; public event TCPCommon.DataSentDelegate DataSent; @@ -127,8 +126,5 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC { Clients[clientID].Send(clientID, data, offset, len); } - - - } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/Common/TRPC/TCPSocket.cs b/OpenSim/Region/ScriptEngine/Common/TRPC/TCPSocket.cs index 1e47439..a14f245 100644 --- a/OpenSim/Region/ScriptEngine/Common/TRPC/TCPSocket.cs +++ b/OpenSim/Region/ScriptEngine/Common/TRPC/TCPSocket.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -33,7 +33,6 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC { public class TCPSocket { - public readonly Socket Client; public readonly int ID; @@ -52,6 +51,7 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC ID = id; Client = client; } + public void Start() { // Start listening @@ -85,10 +85,8 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC // Start new receive BeginReceive(); - } - public void Send(int clientID, byte[] data, int offset, int len) { Client.BeginSend(data, offset, len, SocketFlags.None, new AsyncCallback(asyncDataSent), Client); @@ -111,4 +109,4 @@ namespace OpenSim.Region.ScriptEngine.Common.TRPC Close(ID); } } -} \ No newline at end of file +} -- cgit v1.1