[Delivery-boy-cvs] server/DeliveryBoyS DeliveryBoyS.prjx,1.2,1.3 Main.cs,1.2,1.3
Status: Planning
Brought to you by:
mkloubert
From: Marcel K. <gen...@us...> - 2005-04-28 21:50:07
|
Update of /cvsroot/delivery-boy/server/DeliveryBoyS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8808/DeliveryBoyS Modified Files: DeliveryBoyS.prjx Main.cs Log Message: - use a new TCP Server class with own namespace Index: DeliveryBoyS.prjx =================================================================== RCS file: /cvsroot/delivery-boy/server/DeliveryBoyS/DeliveryBoyS.prjx,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DeliveryBoyS.prjx 5 Mar 2005 10:36:14 -0000 1.2 --- DeliveryBoyS.prjx 28 Apr 2005 21:49:52 -0000 1.3 *************** *** 4,9 **** <File name=".\AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\classes" subtype="Directory" buildaction="Compile" dependson="" data="" /> ! <File name="..\classes\clsEasySocket.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> ! <File name="..\classes\clsEasyTCPServer.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name="..\Global.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> --- 4,8 ---- <File name=".\AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\classes" subtype="Directory" buildaction="Compile" dependson="" data="" /> ! <File name="..\classes\clsTCPServer.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name="..\Global.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> Index: Main.cs =================================================================== RCS file: /cvsroot/delivery-boy/server/DeliveryBoyS/Main.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Main.cs 5 Mar 2005 10:36:14 -0000 1.2 --- Main.cs 28 Apr 2005 21:49:52 -0000 1.3 *************** *** 23,27 **** using System.Text; ! namespace DeliveryBoyS { /*! \class MainClass Main.cs "Main.cs" --- 23,27 ---- using System.Text; ! namespace DeliveryBoyServer { /*! \class MainClass Main.cs "Main.cs" *************** *** 43,46 **** --- 43,49 ---- * \note * $Log$ + * Revision 1.3 2005/04/28 21:49:52 generalpd + * - use a new TCP Server class with own namespace + * * Revision 1.2 2005/03/05 10:36:14 generalpd * - Added classes: Global, clsEasySocket and clsEasyTCPServer *************** *** 54,62 **** { // Server instance ! private clsEasyTCPServer m_oTheServer = null; ! public static int Main(string[] args) { ! return (new MainClass()).Run(); } --- 57,72 ---- { // Server instance ! private CSharp_ClassLib.Classes.TCPServer m_oServer; ! ! public MainClass () ! { ! this.m_oServer = new CSharp_ClassLib.Classes.TCPServer(); ! ! return; ! } ! public static System.Int32 Main(System.String[] args) { ! return (new DeliveryBoyServer.MainClass()).Run(args); } *************** *** 70,74 **** * 1 => Exception */ ! private int Run () { try --- 80,84 ---- * 1 => Exception */ ! private System.Int32 Run (System.String[] args) { try *************** *** 79,83 **** PrintHeader(); ! m_oTheServer = new clsEasyTCPServer(); do --- 89,99 ---- PrintHeader(); ! ! this.m_oServer.MaxConnections = 1024; ! this.m_oServer.Port = 2309; ! this.m_oServer.OnError += new CSharp_ClassLib.Classes.TCPServer.ErrorHandler(this.m_oServer_OnError); ! this.m_oServer.OnAccept += new CSharp_ClassLib.Classes.TCPServer.AcceptHandler(this.m_oServer_OnAccept); ! this.m_oServer.OnReceive += new CSharp_ClassLib.Classes.TCPServer.ReceiveHandler(this.m_oServer_OnReceive); ! this.m_oServer.Start(); do *************** *** 90,101 **** // Runs the server case "r": - if (true == m_oTheServer.Listening) - m_oTheServer.Stop(); - - m_oTheServer.MaxConnections = 10; - m_oTheServer.Port = 1400; - m_oTheServer.OnReceive += new clsEasyTCPServer.ReceiveHandler(ReceiveData); - m_oTheServer.Start(); - Console.WriteLine("Server is running!"); --- 106,109 ---- *************** *** 115,118 **** --- 123,128 ---- while (!bool_ExitDoWhile); + this.m_oServer.Stop(); + // Clear all GC.Collect(); *************** *** 159,169 **** return; ! } ! private void ReceiveData (System.Object sender, clsEasySocket socket, System.Byte[] buffer, System.Int32 bytes_read) { ! ASCIIEncoding ascii = new ASCIIEncoding(); ! ! return; } } --- 169,195 ---- return; ! } ! private void m_oServer_OnError (System.Object sender, System.Exception e) { ! Console.WriteLine("SOCKET EXCEPTION: " + e.Message); ! ! return; ! } ! ! private void m_oServer_OnAccept (System.Object sender, System.Net.Sockets.Socket socket) ! { ! Console.WriteLine("Connection: " + socket.RemoteEndPoint.ToString()); ! ! return; ! } ! ! private void m_oServer_OnReceive (System.Object sender, System.Net.Sockets.Socket socket, System.Byte[] buffer) ! { ! System.Text.ASCIIEncoding oASCII = new System.Text.ASCIIEncoding(); ! ! Console.WriteLine("Data from " + socket.RemoteEndPoint.ToString() + ": " + oASCII.GetString(buffer)); ! ! return; } } |