From: <br...@us...> - 2008-07-25 10:00:36
|
Revision: 301 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=301&view=rev Author: brus07 Date: 2008-07-25 10:00:45 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Remove SocketProtocol unit Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs Removed Paths: ------------- ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs ACMServer/trunk/ACMServer/Library/Connector/SocketProtocol/ Modified: ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-07-23 12:24:09 UTC (rev 300) +++ ACMServer/trunk/ACMServer/Library/Connector/Connector.csproj 2008-07-25 10:00:45 UTC (rev 301) @@ -41,13 +41,7 @@ <Compile Include="Getter\FileGetter.cs" /> <Compile Include="Getter\IGetter.cs" /> <Compile Include="Getter\WebGetter.cs" /> - <Compile Include="ISocket.cs" /> <Compile Include="SocketClient.cs" /> - <Compile Include="SocketProtocol\ArrivedDepthProtocol.cs" /> - <Compile Include="SocketProtocol\EasySocketProtocol.cs" /> - <Compile Include="SocketProtocol\SendDepthProtocol.cs" /> - <Compile Include="SocketProtocol\EmptyProtocol.cs" /> - <Compile Include="SocketProtocol\Protocol.cs" /> <Compile Include="SocketServer.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="WebConnector.cs" /> Deleted: ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs 2008-07-23 12:24:09 UTC (rev 300) +++ ACMServer/trunk/ACMServer/Library/Connector/ISocket.cs 2008-07-25 10:00:45 UTC (rev 301) @@ -1,7 +0,0 @@ -namespace AcmContester.Library.Connector -{ - interface ISocket - { - void OnDataArrived(string message); - } -} Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs 2008-07-23 12:24:09 UTC (rev 300) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketClient.cs 2008-07-25 10:00:45 UTC (rev 301) @@ -1,10 +1,9 @@ using System; using JadBenAutho.EasySocket; -using AcmContester.Library.Connector.SocketProtocol; namespace AcmContester.Library.Connector { - public class SocketClient: ISocket + public class SocketClient { EasyClient client; @@ -56,16 +55,12 @@ return client.IsConnected; } - #region ISocket Members - - public void OnDataArrived(string message) + private void OnDataArrived(string message) { if (onDataArrived != null) { onDataArrived(message); } } - - #endregion } } Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-23 12:24:09 UTC (rev 300) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketServer.cs 2008-07-25 10:00:45 UTC (rev 301) @@ -1,10 +1,9 @@ using System; using JadBenAutho.EasySocket; -using AcmContester.Library.Connector.SocketProtocol; namespace AcmContester.Library.Connector { - public class SocketServer: ISocket + public class SocketServer { int port = 4120; EasyServer server; @@ -16,8 +15,6 @@ { server = new EasyServer(port, true); server.DataArrived += new DataArrived2Server_EventHandler(DataArrived); - - InitProtocol(); } public void Start() @@ -38,12 +35,12 @@ private void DataArrived(object Data, SocketStream DataSender) { - arrivedHead.PrevProcess(Data.ToString()); + OnDataArrived(Data.ToString()); } public void Send(string message) { - sendHead.NextProcess(message); + server.SendData(message, 0); } public int CountClients() @@ -51,47 +48,12 @@ return server.CountClients; } - Protocol sendHead; - Protocol sendNext; - Protocol arrivedHead; - Protocol arrivedNext; - - private void InitProtocol() + private void OnDataArrived(string message) { - Protocol sendProtocol = new SendDepthProtocol(server); - Protocol arrivedProtocol = new ArrivedDepthProtocol(); - ((ArrivedDepthProtocol)arrivedProtocol).onDataArrived += OnDataArrived; - sendHead = arrivedProtocol; - arrivedProtocol.SetNextProtocol(sendProtocol); - sendNext = sendProtocol; - - arrivedHead = sendProtocol; - sendProtocol.SetPrevProtocol(arrivedProtocol); - arrivedNext = arrivedProtocol; - - Protocol easySocketProtocol = new EasySocketProtocol(server); - AddProtocol(easySocketProtocol); - } - - public void AddProtocol(Protocol protocol) - { - protocol.SetNextProtocol(sendNext); - sendHead.SetNextProtocol(protocol); - - protocol.SetPrevProtocol(arrivedHead); - arrivedNext.SetPrevProtocol(protocol); - } - - #region ISocket Members - - public void OnDataArrived(string message) - { if (onDataArrived != null) { onDataArrived(message); } } - - #endregion } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |