delivery-boy-cvs Mailing List for DeliveryBoy
Status: Planning
Brought to you by:
mkloubert
You can subscribe to this list here.
2005 |
Jan
|
Feb
(19) |
Mar
(6) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Marcel K. <gen...@us...> - 2005-04-28 21:50:07
|
Update of /cvsroot/delivery-boy/server/DeliveryBoyS/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8808/DeliveryBoyS/classes Added Files: clsTCPServer.cs Removed Files: clsEasySocket.cs clsEasyTCPServer.cs Log Message: - use a new TCP Server class with own namespace --- clsEasyTCPServer.cs DELETED --- --- NEW FILE: clsTCPServer.cs --- // DeliveryBoy (Client) - FLAC file sharing tool for .NET // http://deliveryboy.sourceforge.net // // // Copyright (C) 2005 Marcel Joachim Kloubert // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // using System; using System.Collections; using System.Net.Sockets; using System.Timers; namespace CSharp_ClassLib.Classes { /*! \brief TCP server class * * \author generalpd * * \version $Revision: 1.1 $ * * \date 2005-04-30 * * \bug none * * \todo none * * \remarks Last changed by: $Author: generalpd $ in revision $Revision: 1.1 $ on $Date: 2005/04/28 21:49:53 $ * * \note * $Log: clsTCPServer.cs,v $ * Revision 1.1 2005/04/28 21:49:53 generalpd * - use a new TCP Server class with own namespace * */ public class TCPServer : System.Object { /// Listening socket private System.Net.Sockets.TcpListener m_oTCPListener; /// Maximum connections private System.Int32 m_iMaximumConnections; /// Local port private System.UInt16 m_iPort; /// Socket connections private System.Net.Sockets.Socket[] m_oConnections; /// Socket connections private System.Int32 m_iBufferSize; // timer that checks for connections attempts private System.Timers.Timer m_oTimer; // Socket buffers private System.Collections.ArrayList m_oSocketBuffers; /// Accept-Event-Handler-Struct public delegate void AcceptHandler(System.Object sender, System.Net.Sockets.Socket socket); /// Accept-Event-Handler public event AcceptHandler OnAccept; /// Error-Event-Handler-Struct public delegate void ErrorHandler(System.Object sender, System.Exception e); /// Error-Event-Handler public event ErrorHandler OnError; /// Receive-Event-Handler-Struct public delegate void ReceiveHandler(System.Object sender, System.Net.Sockets.Socket socket, System.Byte[] buffer); /// Receive-Event-Handler public event ReceiveHandler OnReceive; /*! \fn TCPServer() * \brief Inits all necessary stuff * */ public TCPServer() { this.m_oSocketBuffers = new System.Collections.ArrayList(); this.MaxConnections = 10; this.Port = 23; this.BufferSize = 1024; this.m_oTimer = null; return; } /*! \fn System.UInt32 BufferSize * \brief Retirns or sets the buffer size * * \param value The new buffer size * * \return value The current buffer size * */ public System.Int32 BufferSize { get { return this.m_iBufferSize; } set { this.m_iBufferSize = value; } } /*! \fn System.Int32 MaxConnections * \brief Retirns or sets the maximum connections * * \param value The new maximum connection count * * \return value The maximum connection count * */ public System.Int32 MaxConnections { get { return this.m_iMaximumConnections; } set { System.Int32 i = 0; this.m_iMaximumConnections = value; this.m_oConnections = new System.Net.Sockets.Socket[this.m_iMaximumConnections]; this.m_oSocketBuffers = new System.Collections.ArrayList(); for (i = 0; i < this.m_oConnections.GetLength(0); i++) { this.m_oConnections[i] = null; this.m_oSocketBuffers.Add( new System.Byte[this.BufferSize] ); } } } /*! \fn System.UInt16 Port * \brief Retirns or sets the server port * * \param value The new server port * * \return value The current server port * */ public System.UInt16 Port { get { return this.m_iPort; } set { this.m_iPort = value; } } /*! \fn System.Net.Sockets.Socket Connections * \brief Returns all socket connections * * \return Array of all socket connections * */ public System.Net.Sockets.Socket[] Connections { get { return m_oConnections; } } /*! \fn void Start () * \brief Starts the server * */ public void Start () { try { this.InitListenSocket(); this.m_oTCPListener.Start(); this.m_oTimer = new System.Timers.Timer(125); this.m_oTimer.Elapsed += new System.Timers.ElapsedEventHandler(this.m_oTimer_Elapsed); this.m_oTimer.Enabled = true; } catch (System.Exception e) { this.pOnError(e); } } /*! \fn void Stop () * \brief Stops the server * */ public void Stop () { try { this.m_oTCPListener = null; this.MaxConnections = this.MaxConnections; } catch (System.Exception e) { this.pOnError(e); } } private void pOnError (System.Exception e) { if ("system.net.sockets.socketexception" == e.GetType().FullName.Trim().ToLower()) { if (10054 == ((System.Net.Sockets.SocketException)e).ErrorCode) { // remote closed connection return; } } if (null != this.OnError) this.OnError(this, e); else throw (e); } /*! \fn private void InitListenSocket () * \brief Inits the listening socket with all stuff * */ private void InitListenSocket () { this.m_oTCPListener = new System.Net.Sockets.TcpListener(this.Port); } /*! \fn void m_oTimer_Elapsed (System.Object sender, System.Timers.ElapsedEventArgs e) * \brief Invoked by the timer instance * * \param sender Sender object * \param e Elapsed event arguments * */ private void m_oTimer_Elapsed (System.Object sender, System.Timers.ElapsedEventArgs e) { try { if (this.m_oTCPListener.Pending()) { System.Int32 i = 0; System.Net.Sockets.Socket s = this.m_oTCPListener.AcceptSocket(); System.Boolean boolFoundFreeSocket = false; this.ClearConnections(); for (i = 0; i < this.Connections.GetLength(0); i++) { if (null == this.Connections[i]) { if (null != this.OnAccept) this.OnAccept(this, s); if (s.Connected) { this.Connections[i] = s; this.Connections[i].BeginReceive((System.Byte[])m_oSocketBuffers[i], 0, this.BufferSize, System.Net.Sockets.SocketFlags.None, new System.AsyncCallback(this.pOnReceive), this.Connections[i]); } boolFoundFreeSocket = true; break; } } if (!boolFoundFreeSocket) s.Close(); } } catch (System.Exception e2) { this.pOnError(e2); } return; } /*! \fn void ClearConnections () * \brief Sets all not connected sockets to null * */ private void ClearConnections () { System.Int32 i = 0; for (i = 0; i < this.Connections.GetLength(0); i++) { if (null != this.Connections[i]) { if (!this.Connections[i].Connected) this.Connections[i] = null; } } } private void pOnReceive ( System.IAsyncResult ar ) { try { System.Int32 i = 0; System.Int32 iBytesRead = 0; System.Byte[] bBuffer = new System.Byte[0]; for (i = 0; i < this.Connections.GetLength(0); i++) { if ( this.Connections[i].Equals(ar.AsyncState) ) { iBytesRead = this.Connections[i].EndReceive(ar); bBuffer = new System.Byte[iBytesRead]; System.Array.Copy((System.Byte[])m_oSocketBuffers[i], bBuffer, bBuffer.GetLength(0)); if (null != this.OnReceive) this.OnReceive(this, this.Connections[i], bBuffer); this.Connections[i].BeginReceive((System.Byte[])m_oSocketBuffers[i], 0, this.BufferSize, System.Net.Sockets.SocketFlags.None, new System.AsyncCallback(this.pOnReceive), this.Connections[i]); break; } } } catch (System.Exception e) { this.pOnError(e); } return; } } } --- clsEasySocket.cs DELETED --- |
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; } } |
From: Marcel K. <gen...@us...> - 2005-04-27 15:34:51
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8587/DeliveryBoyC Modified Files: DeliveryBoyC.prjx Global.cs Main.cs Log Message: - some source code optimizations Index: DeliveryBoyC.prjx =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/DeliveryBoyC.prjx,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DeliveryBoyC.prjx 13 Feb 2005 16:46:53 -0000 1.7 --- DeliveryBoyC.prjx 27 Apr 2005 15:34:34 -0000 1.8 *************** *** 4,10 **** <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> <References /> --- 4,10 ---- <File name=".\AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\classes" subtype="Directory" 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="" /> + <File name="..\classes\clsEasySocket.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References /> Index: Main.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/Main.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Main.cs 13 Feb 2005 16:46:53 -0000 1.10 --- Main.cs 27 Apr 2005 15:34:34 -0000 1.11 *************** *** 25,29 **** using System.Reflection; ! namespace DeliveryBoyC { /*! \class MainClass Main.cs "Main.cs" --- 25,29 ---- using System.Reflection; ! namespace DeliveryBoyClient { /*! \class MainClass Main.cs "Main.cs" *************** *** 45,48 **** --- 45,51 ---- * \note * $Log$ + * Revision 1.11 2005/04/27 15:34:34 generalpd + * - some source code optimizations + * * Revision 1.10 2005/02/13 16:46:53 generalpd * - moved application run code to seperate method Run() Index: Global.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/Global.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Global.cs 13 Feb 2005 16:46:53 -0000 1.1 --- Global.cs 27 Apr 2005 15:34:34 -0000 1.2 *************** *** 40,43 **** --- 40,46 ---- * \note * $Log$ + * Revision 1.2 2005/04/27 15:34:34 generalpd + * - some source code optimizations + * * Revision 1.1 2005/02/13 16:46:53 generalpd * - moved application run code to seperate method Run() *************** *** 50,54 **** */ ! public abstract class clsGlobal : System.Object { /// Name of this application --- 53,57 ---- */ ! public sealed class clsGlobal : System.Object { /// Name of this application |
From: Marcel K. <gen...@us...> - 2005-04-27 15:34:51
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8587/DeliveryBoyC/classes Modified Files: clsEasySocket.cs clsEasyTCPServer.cs Log Message: - some source code optimizations Index: clsEasyTCPServer.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/classes/clsEasyTCPServer.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** clsEasyTCPServer.cs 5 Mar 2005 10:29:43 -0000 1.6 --- clsEasyTCPServer.cs 27 Apr 2005 15:34:35 -0000 1.7 *************** *** 31,35 **** * \brief Easy-to-use TCP Server class. * ! * This class is a simple TCP server class that uses clsEasySocket * * \author generalpd --- 31,35 ---- * \brief Easy-to-use TCP Server class. * ! * This class is a simple TCP server class that uses EasySocket * * \author generalpd *************** *** 45,48 **** --- 45,51 ---- * \note * $Log$ + * Revision 1.7 2005/04/27 15:34:35 generalpd + * - some source code optimizations + * * Revision 1.6 2005/03/05 10:29:43 generalpd * - clsEasyTCPServer class now works *************** *** 72,92 **** * */ ! public class clsEasyTCPServer { /// Timer ! private Timer m_oTimer = null; /// Listen socket ! private TcpListener m_oListenSocket = null; /// Local port ! private Int32 m_i32Port = -1; ! /// Last occurred exception ! private Exception m_oLastException = null; /// Listen queue size ! private Int32 m_i32ListenQueue = -1; /// Maximum connections ! private UInt32 m_ui32MaxConnections = 0; /// Connections ! private clsEasySocket[] m_oConnections; /// Accept-Event-Handler-Struct --- 75,93 ---- * */ ! public class EasyTCPServer { /// Timer ! private System.Timers.Timer m_oTimer = null; /// Listen socket ! private System.Net.Sockets.TcpListener m_oListenSocket = null; /// Local port ! private System.Int32 m_i32Port = -1; /// Listen queue size ! private System.Int32 m_i32ListenQueue = -1; /// Maximum connections ! private System.UInt32 m_ui32MaxConnections = 0; /// Connections ! private DeliveryBoyClient.Classes.EasySocket[] m_oConnections; /// Accept-Event-Handler-Struct *************** *** 95,128 **** public event AcceptHandler OnAccept; /// Receive-Event-Handler-Struct ! public delegate void ReceiveHandler(System.Object sender, clsEasySocket socket, System.Byte[] buffer, System.Int32 bytes_read); /// Receive-Event-Handler public event ReceiveHandler OnReceive; /*! \fn public clsEasyTCPServer * \brief Inits all necessary stuff * - * \param (none) - * - * \return (none) */ ! public clsEasyTCPServer() { //ListenQueue = m_oListenSocket.ListenQueue; ! MaxConnections = 0; } /*! \property public UInt32 Connections ! * \brief Returns all availible clsEasySocket connections. ! * ! * \param (none) * * \return List of all connections */ ! public clsEasySocket[] Connections { ! get ! { ! return m_oConnections; ! } } --- 96,125 ---- public event AcceptHandler OnAccept; /// Receive-Event-Handler-Struct ! public delegate void ReceiveHandler(System.Object sender, DeliveryBoyClient.Classes.EasySocket socket, System.Byte[] buffer, System.Int32 bytes_read); /// Receive-Event-Handler public event ReceiveHandler OnReceive; + /// Error-Event-Handler-Struct + public delegate void ErrorHandler(System.Object sender, System.Exception e); + /// Error-Event-Handler + public event ErrorHandler OnError; /*! \fn public clsEasyTCPServer * \brief Inits all necessary stuff * */ ! public EasyTCPServer() { //ListenQueue = m_oListenSocket.ListenQueue; ! this.MaxConnections = 0; } /*! \property public UInt32 Connections ! * \brief Returns all availible EasySocket connections. * * \return List of all connections */ ! public DeliveryBoyClient.Classes.EasySocket[] Connections { ! get { return this.m_oConnections; } } *************** *** 134,154 **** * \return Maximum connections (0 => unlimited) */ ! public UInt32 MaxConnections { ! get ! { ! return m_ui32MaxConnections; ! } set { ! int i = 0; ! ! m_ui32MaxConnections = value; ! m_oConnections = new clsEasySocket[m_ui32MaxConnections]; ! for (i = 0; i < m_oConnections.GetLength(0); i++) ! m_oConnections[i] = new clsEasySocket(); } } --- 131,147 ---- * \return Maximum connections (0 => unlimited) */ ! public System.UInt32 MaxConnections { ! get { return this.m_ui32MaxConnections; } set { ! System.Int32 i = 0; ! this.m_ui32MaxConnections = value; ! this.m_oConnections = new DeliveryBoyClient.Classes.EasySocket[this.m_ui32MaxConnections]; ! for (i = 0; i < this.m_oConnections.GetLength(0); i++) ! this.m_oConnections[i] = new DeliveryBoyClient.Classes.EasySocket(); } } *************** *** 161,175 **** * \return Size of listen queue */ ! public Int32 ListenQueue { ! get ! { ! return m_i32ListenQueue; ! } ! set ! { ! m_i32ListenQueue = value; ! } } --- 154,162 ---- * \return Size of listen queue */ ! public System.Int32 ListenQueue { ! get { return this.m_i32ListenQueue; } ! set { this.m_i32ListenQueue = value; } } *************** *** 181,195 **** * \return Port */ ! public Int32 Port { ! get ! { ! return m_i32Port; ! } set { ! m_i32Port = value; ! InitListenSocket(); } } --- 168,179 ---- * \return Port */ ! public System.Int32 Port { ! get { return this.m_i32Port; } set { ! this.m_i32Port = value; ! this.InitListenSocket(); } } *************** *** 198,212 **** * \brief Return if this server is listening * - * \param (none) - * * \return Is listening (true) or not (false) */ ! public bool Listening { ! get ! { ! // return m_oListenSocket.Connected; ! return true; ! } } --- 182,190 ---- * \brief Return if this server is listening * * \return Is listening (true) or not (false) */ ! public System.Boolean Listening { ! get { return true; } } *************** *** 214,237 **** * \brief Stops the server. * - * \param (none) - * - * \return Error code:<BR> - * 0 => no error<BR> - * 1 => general exception<BR> - * 2 => not listening */ ! public UInt32 Stop () { try { ! m_oTimer.Stop(); ! m_oTimer = null; ! m_oListenSocket.Stop(); ! return SetLastException(0, null); } ! catch (Exception e) { ! return SetLastException(1, e); } } --- 192,209 ---- * \brief Stops the server. * */ ! public void Stop () { try { ! this.m_oTimer.Stop(); ! this.m_oTimer = null; ! this.m_oListenSocket.Stop(); ! return; } ! catch (System.Exception e) { ! this.pOnError(e); } } *************** *** 240,311 **** * \brief Starts the server. * - * \param (none) - * - * \return Error code:<BR> - * 0 => no error<BR> - * 1 => general exception<BR> - * 2 => already listening */ ! public UInt32 Start () { try { // Init listener and start it ! InitListenSocket(); ! m_oListenSocket.Start(); // init timer and start it ! m_oTimer = new Timer(125); ! m_oTimer.Elapsed += new ElapsedEventHandler(this.TimerElapsed); ! m_oTimer.Start(); ! return SetLastException(0, null); } ! catch (Exception e) { ! return SetLastException(1, e); } } - /*! \property public Exception LastException - * \brief Returns the last occurred exception. - * - * \param (none) - * - * \return Exception object (null => no error) - */ - public Exception LastException - { - get - { - return m_oLastException; - } - } - - /*! \fn private UInt32 SetLastException (UInt32 ui32_ErrorCode, Exception oNewException) - * \brief Sets the last occurred exception. - * - * \param ui32_ErrorCode Error code. - * \param oNewException The new exception object. - * - * \return Error code submitted by ui32_ErrorCode - */ - private UInt32 SetLastException (UInt32 ui32_ErrorCode, Exception oNewException) - { - m_oLastException = oNewException; - - return ui32_ErrorCode; - } - /*! \fn private void InitListenSocket () * \brief Inits the listening socket with all stuff * - * \param (none) - * - * \return (none) */ private void InitListenSocket () { ! m_oListenSocket = new TcpListener(Port); return; --- 212,244 ---- * \brief Starts the server. * */ ! public void Start () { try { // Init listener and start it ! this.InitListenSocket(); ! this.m_oListenSocket.Start(); // init timer and start it ! this.m_oTimer = new System.Timers.Timer(125); ! this.m_oTimer.Elapsed += new System.Timers.ElapsedEventHandler(this.TimerElapsed); ! this.m_oTimer.Start(); ! return; } ! catch (System.Exception e) { ! this.pOnError(e); } } /*! \fn private void InitListenSocket () * \brief Inits the listening socket with all stuff * */ private void InitListenSocket () { ! this.m_oListenSocket = new System.Net.Sockets.TcpListener(this.Port); return; *************** *** 320,351 **** * \return (none) */ ! private void TimerElapsed (object sender, ElapsedEventArgs e) { ! if (m_oListenSocket.Pending()) { ! int i = 0; ! bool boolIsFull = true; ! Socket s = m_oListenSocket.AcceptSocket(); ! if (null != OnAccept) ! OnAccept(this, s); ! if (s.Connected) ! { ! for (i = 0; i < m_oConnections.GetLength(0); i++) ! { ! if (!m_oConnections[i].Connected) ! { ! m_oConnections[i] = new clsEasySocket(s); ! m_oConnections[i].OnReceive += new clsEasySocket.ReceiveHandler(ReceiveData); ! boolIsFull = false; ! break; ! } ! } ! if (boolIsFull) ! s.Close(); ! } } --- 253,291 ---- * \return (none) */ ! private void TimerElapsed (System.Object sender, System.Timers.ElapsedEventArgs e) { ! try { ! if (this.m_oListenSocket.Pending()) ! { ! System.Int32 i = 0; ! System.Boolean boolIsFull = true; ! System.Net.Sockets.Socket s = this.m_oListenSocket.AcceptSocket(); ! if (null != this.OnAccept) ! this.OnAccept(this, s); ! if (s.Connected) ! { ! for (i = 0; i < this.m_oConnections.GetLength(0); i++) ! { ! if (!this.m_oConnections[i].Connected) ! { ! this.m_oConnections[i] = new DeliveryBoyClient.Classes.EasySocket(s); ! this.m_oConnections[i].OnReceive += new DeliveryBoyClient.Classes.EasySocket.ReceiveHandler(this.ReceiveData); ! boolIsFull = false; ! break; ! } ! } ! if (boolIsFull) ! s.Close(); ! } ! } ! } ! catch (System.Exception e2) ! { ! this.pOnError(e2); } *************** *** 364,371 **** private void ReceiveData (System.Object sender, System.Byte[] buffer, System.Int32 bytes_read) { ! if (null != OnReceive) ! OnReceive(this, (clsEasySocket)sender, buffer, bytes_read); return; } } --- 304,328 ---- private void ReceiveData (System.Object sender, System.Byte[] buffer, System.Int32 bytes_read) { ! if (null != this.OnReceive) ! this.OnReceive(this, (DeliveryBoyClient.Classes.EasySocket)sender, buffer, bytes_read); return; } + + /*! \fn private void pOnError ( Exception e ) + * \brief Is invoked if an error occurred + * + * \param ar Async result + * + * \return (none) + */ + private void pOnError ( System.Exception e ) + { + if (null != this.OnError) + this.OnError(this, e); + else + throw (e); + + return; + } } Index: clsEasySocket.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/classes/clsEasySocket.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** clsEasySocket.cs 13 Feb 2005 16:46:53 -0000 1.11 --- clsEasySocket.cs 27 Apr 2005 15:34:34 -0000 1.12 *************** *** 43,46 **** --- 43,49 ---- * \note * $Log$ + * Revision 1.12 2005/04/27 15:34:34 generalpd + * - some source code optimizations + * * Revision 1.11 2005/02/13 16:46:53 generalpd * - moved application run code to seperate method Run() *************** *** 65,648 **** [...988 lines suppressed...] ! * \return (none) ! */ ! private void pOnConnectWithRemote ( System.IAsyncResult ar ) ! { ! try ! { ! this.Socket.EndConnect(ar); ! if (null != this.OnConnectWithRemote) ! this.OnConnectWithRemote(this, this.m_oSocket); ! return; ! } ! catch (System.Exception e) ! { ! this.pOnError(e); ! } ! } ! } } |
From: Marcel K. <gen...@us...> - 2005-03-31 06:23:09
|
Update of /cvsroot/delivery-boy/DeliveryBoy_CMS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13164 Added Files: index.php Log Message: - first import --- NEW FILE: index.php --- <? ?> |
From: Marcel K. <gen...@us...> - 2005-03-05 10:36:34
|
Update of /cvsroot/delivery-boy/server/DeliveryBoyS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14590/DeliveryBoyS Modified Files: DeliveryBoyS.prjx Main.cs Added Files: Global.cs Log Message: - Added classes: Global, clsEasySocket and clsEasyTCPServer - Added GPL License & Readme.txt - Added some functions, like menu browsing or starting the server (incl. event) to the MainClass Index: DeliveryBoyS.prjx =================================================================== RCS file: /cvsroot/delivery-boy/server/DeliveryBoyS/DeliveryBoyS.prjx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DeliveryBoyS.prjx 30 Jan 2005 22:08:17 -0000 1.1 --- DeliveryBoyS.prjx 5 Mar 2005 10:36:14 -0000 1.2 *************** *** 3,6 **** --- 3,10 ---- <File name=".\Main.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <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> <References /> --- NEW FILE: Global.cs --- // DeliveryBoy (Client) - FLAC file sharing tool for .NET // http://deliveryboy.sourceforge.net // // // Copyright (C) 2005 Marcel Joachim Kloubert // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // using System; /*! \class Global Global.cs "Global.cs" * * \brief Global * * This abstract class contains global stuff * * \author generalpd * * \date 2005-02-19 * * \bug (none) * * \remarks Last changed by: $Author: generalpd $ in revision $Revision: 1.1 $ on $Date: 2005/03/05 10:36:14 $ * * \todo (none) * * \note * $Log: Global.cs,v $ * Revision 1.1 2005/03/05 10:36:14 generalpd * - Added classes: Global, clsEasySocket and clsEasyTCPServer * - Added GPL License & Readme.txt * - Added some functions, like menu browsing or starting the server (incl. event) to the MainClass * * * */ public abstract class clsGlobal : System.Object { /// Name of this application private static string m_strAppName = "DeliveryBoy (Server)"; /// Version of this application private static string m_strVersion = "0.01"; /// Kind of version (alpha, beta, stable / etc.) private static string m_strVersionKind = "pre-alpha"; public static string CompleteAppName { get { return m_strAppName + " v" + m_strVersion + " " + m_strVersionKind; } } } Index: Main.cs =================================================================== RCS file: /cvsroot/delivery-boy/server/DeliveryBoyS/Main.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Main.cs 30 Jan 2005 22:08:17 -0000 1.1 --- Main.cs 5 Mar 2005 10:36:14 -0000 1.2 *************** *** 21,32 **** using System; namespace DeliveryBoyS { ! class MainClass { ! public static void Main(string[] args) { ! Console.WriteLine("DeliveryBoy (Server)"); } } --- 21,169 ---- using System; + using System.Text; namespace DeliveryBoyS { ! /*! \class MainClass Main.cs "Main.cs" ! * ! * \brief Entry-point class ! * ! * This is the entry point class. ! * ! * \author generalpd ! * ! * \date 2005-01-30 ! * ! * \bug (none) ! * ! * \remarks Last changed by: $Author$ in Revision $Revision$ on $Date$ ! * ! * \todo (none) ! * ! * \note ! * $Log$ ! * Revision 1.2 2005/03/05 10:36:14 generalpd ! * - Added classes: Global, clsEasySocket and clsEasyTCPServer ! * - Added GPL License & Readme.txt ! * - Added some functions, like menu browsing or starting the server (incl. event) to the MainClass ! * ! * ! */ ! ! class MainClass { ! // Server instance ! private clsEasyTCPServer m_oTheServer = null; ! ! public static int Main(string[] args) { ! return (new MainClass()).Run(); ! } ! ! /*! \fn protected int Run () ! * \brief Runs the application ! * ! * \param (none) ! * ! * \return Error code: ! * 0 => No error ! * 1 => Exception ! */ ! private int Run () ! { ! try ! { ! bool bool_ExitDoWhile = false; ! string str_ConsoleInput = ""; ! ! PrintHeader(); ! ! m_oTheServer = new clsEasyTCPServer(); ! ! do ! { ! Console.Write("> "); ! str_ConsoleInput = Console.ReadLine(); ! ! switch (str_ConsoleInput.Trim()) ! { ! // 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!"); ! ! break; ! ! // Exit application ! case "q": ! bool_ExitDoWhile = true; ! break; ! ! // Print help menu ! case "?": ! PrintHelp(); ! break; ! } ! } ! while (!bool_ExitDoWhile); ! ! // Clear all ! GC.Collect(); ! GC.WaitForPendingFinalizers(); ! ! return 0; ! } ! catch (Exception e) ! { ! Console.WriteLine(e.Message); ! ! return 1; ! } ! } ! ! /*! \fn private void PrintHeader () ! * \brief Prints the app name & version to the screen ! * ! * \param (none) ! * ! * \return (none) ! */ ! private void PrintHeader () ! { ! Console.WriteLine(clsGlobal.CompleteAppName); ! Console.WriteLine("----------------------------------------"); ! ! return; ! } ! ! /*! \fn private void PrintHelp () ! * \brief Prints the help menu with all commands ! * ! * \param (none) ! * ! * \return (none) ! */ ! private void PrintHelp () ! { ! Console.WriteLine(""); ! Console.WriteLine("[q] Exit program"); ! Console.WriteLine("[?] Print this screen"); ! Console.WriteLine(""); ! ! return; ! } ! ! private void ReceiveData (System.Object sender, clsEasySocket socket, System.Byte[] buffer, System.Int32 bytes_read) ! { ! ASCIIEncoding ascii = new ASCIIEncoding(); ! ! return; } } |
From: Marcel K. <gen...@us...> - 2005-03-05 10:36:28
|
Update of /cvsroot/delivery-boy/server/DeliveryBoyS/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14590/DeliveryBoyS/classes Added Files: clsEasySocket.cs clsEasyTCPServer.cs Log Message: - Added classes: Global, clsEasySocket and clsEasyTCPServer - Added GPL License & Readme.txt - Added some functions, like menu browsing or starting the server (incl. event) to the MainClass --- NEW FILE: clsEasyTCPServer.cs --- // DeliveryBoy (Client) - FLAC file sharing tool for .NET // http://deliveryboy.sourceforge.net // // // Copyright (C) 2005 Marcel Joachim Kloubert // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // using System; using System.Collections; using System.Net.Sockets; using System.Timers; /*! \class clsEasyTCPServer clsEasyTCPServer.cs "clsEasyTCPServer.cs" * * \brief Easy-to-use TCP Server class. * * This class is a simple TCP server class that uses clsEasySocket * * \author generalpd * * \date 2005-01-30 * * \bug (none) * * \remarks Last changed by: $Author: generalpd $ in revision $Revision: 1.1 $ on $Date: 2005/03/05 10:36:14 $ * * \todo Adding methods for handling data transfer between sockets. * * \note * $Log: clsEasyTCPServer.cs,v $ * Revision 1.1 2005/03/05 10:36:14 generalpd * - Added classes: Global, clsEasySocket and clsEasyTCPServer * - Added GPL License & Readme.txt * - Added some functions, like menu browsing or starting the server (incl. event) to the MainClass * * * */ public class clsEasyTCPServer { /// Timer private Timer m_oTimer = null; /// Listen socket private TcpListener m_oListenSocket = null; /// Local port private Int32 m_i32Port = -1; /// Last occurred exception private Exception m_oLastException = null; /// Listen queue size private Int32 m_i32ListenQueue = -1; /// Maximum connections private UInt32 m_ui32MaxConnections = 0; /// Connections private clsEasySocket[] m_oConnections; /// Accept-Event-Handler-Struct public delegate void AcceptHandler(System.Object sender, System.Net.Sockets.Socket socket); /// Accept-Event-Handler public event AcceptHandler OnAccept; /// Receive-Event-Handler-Struct public delegate void ReceiveHandler(System.Object sender, clsEasySocket socket, System.Byte[] buffer, System.Int32 bytes_read); /// Receive-Event-Handler public event ReceiveHandler OnReceive; /*! \fn public clsEasyTCPServer * \brief Inits all necessary stuff * * \param (none) * * \return (none) */ public clsEasyTCPServer() { //ListenQueue = m_oListenSocket.ListenQueue; MaxConnections = 0; } /*! \property public UInt32 Connections * \brief Returns all availible clsEasySocket connections. * * \param (none) * * \return List of all connections */ public clsEasySocket[] Connections { get { return m_oConnections; } } /*! \property public UInt32 MaxConnections * \brief Returns the size of maximum server connections or sets it. * * \param value New size (0 => unlimited) * * \return Maximum connections (0 => unlimited) */ public UInt32 MaxConnections { get { return m_ui32MaxConnections; } set { int i = 0; m_ui32MaxConnections = value; m_oConnections = new clsEasySocket[m_ui32MaxConnections]; for (i = 0; i < m_oConnections.GetLength(0); i++) m_oConnections[i] = new clsEasySocket(); } } /*! \property public Int32 ListenQueue * \brief Returns the size of the listen queue or sets it. * * \param value New size * * \return Size of listen queue */ public Int32 ListenQueue { get { return m_i32ListenQueue; } set { m_i32ListenQueue = value; } } /*! \fn public Int32 Port * \brief Return or set the port of this server * * \param value New port * * \return Port */ public Int32 Port { get { return m_i32Port; } set { m_i32Port = value; InitListenSocket(); } } /*! \fn public bool Listening * \brief Return if this server is listening * * \param (none) * * \return Is listening (true) or not (false) */ public bool Listening { get { // return m_oListenSocket.Connected; return true; } } /*! \fn public UInt32 Stop () * \brief Stops the server. * * \param (none) * * \return Error code:<BR> * 0 => no error<BR> * 1 => general exception<BR> * 2 => not listening */ public UInt32 Stop () { try { m_oTimer.Stop(); m_oTimer = null; m_oListenSocket.Stop(); return SetLastException(0, null); } catch (Exception e) { return SetLastException(1, e); } } /*! \fn public UInt32 Start () * \brief Starts the server. * * \param (none) * * \return Error code:<BR> * 0 => no error<BR> * 1 => general exception<BR> * 2 => already listening */ public UInt32 Start () { try { // Init listener and start it InitListenSocket(); m_oListenSocket.Start(); // init timer and start it m_oTimer = new Timer(125); m_oTimer.Elapsed += new ElapsedEventHandler(this.TimerElapsed); m_oTimer.Start(); return SetLastException(0, null); } catch (Exception e) { return SetLastException(1, e); } } /*! \property public Exception LastException * \brief Returns the last occurred exception. * * \param (none) * * \return Exception object (null => no error) */ public Exception LastException { get { return m_oLastException; } } /*! \fn private UInt32 SetLastException (UInt32 ui32_ErrorCode, Exception oNewException) * \brief Sets the last occurred exception. * * \param ui32_ErrorCode Error code. * \param oNewException The new exception object. * * \return Error code submitted by ui32_ErrorCode */ private UInt32 SetLastException (UInt32 ui32_ErrorCode, Exception oNewException) { m_oLastException = oNewException; return ui32_ErrorCode; } /*! \fn private void InitListenSocket () * \brief Inits the listening socket with all stuff * * \param (none) * * \return (none) */ private void InitListenSocket () { m_oListenSocket = new TcpListener(Port); return; } /*! \fn private void TimerElapsed (object sender, ElapsedEventArgs e); * \brief Timer elapsed * * \param sender This timer instance * \param ElapsedEventArgs Arguments * * \return (none) */ private void TimerElapsed (object sender, ElapsedEventArgs e) { if (m_oListenSocket.Pending()) { int i = 0; bool boolIsFull = true; Socket s = m_oListenSocket.AcceptSocket(); if (null != OnAccept) OnAccept(this, s); if (s.Connected) { for (i = 0; i < m_oConnections.GetLength(0); i++) { if (!m_oConnections[i].Connected) { m_oConnections[i] = new clsEasySocket(s); m_oConnections[i].OnReceive += new clsEasySocket.ReceiveHandler(ReceiveData); boolIsFull = false; break; } } if (boolIsFull) s.Close(); } } return; } /*! \fn private void ReceiveData (System.Object sender, System.Byte[] buffer, System.Int32 bytes_read); * \brief Data ready for read * * \param sender This timer instance * \param buffer Data * \param bytes_read # of bytes that are ready for reading * * \return (none) */ private void ReceiveData (System.Object sender, System.Byte[] buffer, System.Int32 bytes_read) { if (null != OnReceive) OnReceive(this, (clsEasySocket)sender, buffer, bytes_read); return; } } --- NEW FILE: clsEasySocket.cs --- // DeliveryBoy (Client) - FLAC file sharing tool for .NET // http://deliveryboy.sourceforge.net // // // Copyright (C) 2005 Marcel Joachim Kloubert // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // using System; using System.Net; using System.Net.Sockets; using System.Text; /*! \class clsEasySocket clsEasySocket.cs "clsEasySocket.cs" * * \brief Easy-to-use socket class. * * This class is a simple version of the System.Net.Socket.Socket-Class * * \author generalpd * * \date 2005-01-30 * * \bug (none) * * \remarks Last changed by: $Author: generalpd $ in revision $Revision: 1.1 $ on $Date: 2005/03/05 10:36:14 $ * * \todo Adding methods for handling data transfer between sockets. * * \note * $Log: clsEasySocket.cs,v $ * Revision 1.1 2005/03/05 10:36:14 generalpd * - Added classes: Global, clsEasySocket and clsEasyTCPServer * - Added GPL License & Readme.txt * - Added some functions, like menu browsing or starting the server (incl. event) to the MainClass * * * */ public class clsEasySocket { /// Default buffer size in byte private const Int32 DEFAULT_BUFFER_SIZE = 1024; /// Default listen queue size private const Int32 DEFAULT_LISTENQUEUE_SIZE = 16; /// Byte buffer private byte[] b_Buffer; /// Last occurred exception private Exception m_oLastException = null; /// For ASCII conversion private ASCIIEncoding m_oASCII = null; /// Socket private Socket m_oSocket = null; /// Local port private Int32 m_i32LocalPort = 0; /// Remote address private string m_strRemoteAddr = "0.0.0.0"; /// Remote port private Int32 m_i32RemotePort = 0; /// Remote end point private IPEndPoint m_RemoteEndPoint = null; /// Listen queue private Int32 m_i32ListenQueue = -1; /// Listen queue private Int32 m_i32BufferSize = 0; /// Auto accept? private bool m_boolAutoAccept = true; /// Use this address type private const AddressFamily c_AddressFamily = AddressFamily.InterNetwork; /// Use this socket type private const SocketType c_SocketType = SocketType.Stream; /// Use this protocol type private const ProtocolType c_ProtocolType = ProtocolType.Tcp; /// Accept-Event-Handler-Struct public delegate void AcceptHandler(System.Object sender, System.Net.Sockets.Socket socket); /// Accept-Event-Handler public event AcceptHandler OnAccept; /// Connect-Event-Handler-Struct public delegate void ConnectHandler(System.Object sender, System.Net.Sockets.Socket socket); /// Connect-Event-Handler public event ConnectHandler OnConnect; public event ConnectHandler OnConnectWithRemote; /// Error-Event-Handler-Struct public delegate void ErrorHandler(System.Object sender, System.Exception e); /// Error-Event-Handler public event ErrorHandler OnError; /// Receive-Event-Handler-Struct public delegate void ReceiveHandler(System.Object sender, System.Byte[] buffer, System.Int32 bytes_read); /// Receive-Event-Handler public event ReceiveHandler OnReceive; /*! \fn clsEasySocket * \brief Inits all necessary stuff * * \param (none) * * \return (none) */ public clsEasySocket() { m_oSocket = new Socket(c_AddressFamily, c_SocketType, c_ProtocolType); InitRest(); } /*! \fn clsEasySocket * \brief Inits all necessary stuff * * \param socket * * \return (none) */ public clsEasySocket(Socket socket) { m_oSocket = socket; InitRest(); if (m_oSocket.Connected) m_oSocket.BeginReceive(b_Buffer, 0, BufferSize, SocketFlags.None, new AsyncCallback(this.pOnReceive), m_oSocket); } /*! \fn private void InitRest () * \brief Inits the rest * * \param (none) * * \return (none) */ private void InitRest () { // initialize all necessary vars m_oASCII = new ASCIIEncoding(); RemoteAddress = "0.0.0.0"; RemotePort = 0; ListenQueue = DEFAULT_LISTENQUEUE_SIZE; BufferSize = DEFAULT_BUFFER_SIZE; AutoAccept = true; SocketObject.Blocking = false; b_Buffer = new byte[BufferSize]; SetLastException(0, null); } /*! \property public string RemoteAddress * * \brief Returns the remote address or sets it. * * \param value New remote address * * \return Remote address */ public string RemoteAddress { get { return m_strRemoteAddr; } set { try { m_RemoteEndPoint = GetEndPoint(value.Trim(), RemotePort); m_strRemoteAddr = value.Trim(); SetLastException(0, null); } catch (Exception e) { SetLastException(1, e); } } } /*! \property public Int32 ListenQueue * \brief Returns the size of the listen queue or sets it. * * \param value New size * * \return Size of listen queue */ public Int32 ListenQueue { get { return m_i32ListenQueue; } set { m_i32ListenQueue = value; } } /*! \property public Int32 BufferSize * \brief Returns the socket buffer size in bytes or sets it. * * \param value New size * * \return Size of buffer, in byte */ public Int32 BufferSize { get { return m_i32BufferSize; } set { m_i32BufferSize = value; } } /*! \property public Int32 RemotePort * \brief Returns the remote port or sets it. * * \param value New remote port * * \return Remote port */ public Int32 RemotePort { get { return m_i32RemotePort; } set { try { m_RemoteEndPoint = GetEndPoint(RemoteAddress, value); m_i32RemotePort = value; SetLastException(0, null); } catch (Exception e) { SetLastException(1, e); } } } /*! \property public Socket SocketObject * \brief Returns the socket object. * * \param (none) * * \return Socket object */ public System.Net.Sockets.Socket SocketObject { get { return m_oSocket; } } /*! \property public Int32 LocalPort * \brief Returns the local port or sets it. * * \param value New local port * * \return Local port */ public Int32 LocalPort { get { return m_i32LocalPort; } set { m_i32LocalPort = value; } } /*! \property public bool Connected * \brief Returns if this socket is connected or not. * * \param (none) * * \return Is connected (TRUE) or not (FALSE) */ public bool Connected { get { return m_oSocket.Connected; } } /*! \property public Exception LastException * \brief Returns the last occurred exception. * * \param (none) * * \return Exception object (null => no error) */ public Exception LastException { get { return m_oLastException; } } /*! \fn private UInt32 SetLastException (UInt32 ui32_ErrorCode, Exception oNewException) * \brief Sets the last occurred exception. * * \param ui32_ErrorCode Error code. * \param oNewException The new exception object. * * \return Error code submitted by ui32_ErrorCode */ private UInt32 SetLastException (UInt32 ui32_ErrorCode, Exception oNewException) { m_oLastException = oNewException; return ui32_ErrorCode; } /*! \fn public UInt32 Connect() * \brief Connects to RemoteAddress:RemotePort. * * \param (none) * * \return Error code:<BR> * 0 => no error<BR> * 1 => general exception<br> * 2 => already connected */ public UInt32 Connect() { try { if (!Connected) { SocketObject.BeginConnect(m_RemoteEndPoint, new AsyncCallback(this.pOnConnectWithRemote), SocketObject); return SetLastException(0, null); } else return SetLastException(2, null); } catch (Exception e) { return SetLastException(1, e); } } /*! \fn public UInt32 SocketObject() * \brief Disconnects or close socket. * * \param (none) * * \return Error code:<BR> * 0 => no error<BR> * 1 => general exception<br> * 2 => not connected */ public UInt32 Close() { try { if (!Connected) return SetLastException(2, null); else { SocketObject.Shutdown(SocketShutdown.Both); SocketObject.Close(); return SetLastException(0, null); } } catch (Exception e) { return SetLastException(1, e); } } /*! \fn public bool AutoAccept * \brief Accept each connection request or first run OnAccept-event. * * \param value New state:<BR> * TRUE => Accept each connection request<BR> * FALSE => First run OnAccept event * * \return State:<BR> * TRUE => Accept each connection request<BR> * FALSE => First run OnAccept event */ public bool AutoAccept { get { return m_boolAutoAccept; } set { m_boolAutoAccept = value; } } /*! \fn private IPEndPoint GetEndPoint (string str_Address, Int32 i32_Port) * \brief Creates an end point by an ip address and a port * * \param string str_Address * \param i32_Port Port * * \return End point ... or null if an exception occurred */ private IPEndPoint GetEndPoint (string str_Address, Int32 i32_Port) { try { // create end point IPAddress oIPAddress = Dns.Resolve(str_Address.Trim()).AddressList[0]; IPEndPoint oIPEndPoint = new IPEndPoint(oIPAddress, i32_Port); SetLastException(0, null); return oIPEndPoint; } catch (Exception e) { SetLastException(1, e); return null; } } /*! \fn public UInt32 SendString(string str_Expression) * \brief Sends a string to the remote host. * * \param str_Expression The string that should be send * * \return Error code:<BR> * 0 => no error<BR> * 1 => general exception<BR> * 2 => not connected */ public UInt32 SendString(string str_Expression) { try { byte[] bBuffer = m_oASCII.GetBytes(str_Expression); return SetLastException(Send(bBuffer), LastException); } catch (Exception e) { return SetLastException(1, e); } } /*! \fn public UInt32 Send(byte[] b_Bytes) * \brief Sends a couple of bytes to the remote host. * * \param b_Bytes Array of bytes * * \return Error code:<BR> * 0 => no error<BR> * 1 => general exception<BR> * 2 => not connected */ public UInt32 Send(byte[] b_Bytes) { try { if (Connected) { SocketObject.Send(b_Bytes); return SetLastException(0, null); } else // Not connected return SetLastException(2, null); } catch (Exception e) { return SetLastException(1, e); } } /*! \fn public UInt32 Listen() * \brief Listen from for connections from LocalAddress:LocalPort. * * \param (none) * * \return Error code:<BR> * 0 => no error<BR> * 1 => general exception<br> * 2 => already connected */ public UInt32 Listen() { try { if (!Connected) { SocketObject.Bind( new IPEndPoint(IPAddress.Any, LocalPort)); SocketObject.Listen(ListenQueue); SocketObject.BeginAccept( new AsyncCallback(this.pOnConnectRequest), SocketObject); return SetLastException(0, null); } else return SetLastException(2, null); } catch (Exception e) { return SetLastException(1, e); } } /*! \fn private void pOnConnectRequest ( IAsyncResult ar ) * \brief Is invoked if a remote socket wants to connect * * \param ar Async result * * \return (none) */ private void pOnConnectRequest ( IAsyncResult ar ) { try { if (AutoAccept) { m_oSocket = SocketObject.EndAccept(ar); if (null != OnConnect) this.OnConnect(this, m_oSocket); m_oSocket.BeginReceive(b_Buffer, 0, BufferSize, SocketFlags.None, new AsyncCallback(this.pOnReceive), m_oSocket); } else { if (null != OnAccept) this.OnAccept(this, m_oSocket); } } catch (Exception e) { pOnError(e); } return; } /*! \fn private void pOnReceive ( IAsyncResult ar ) * \brief Is invoked if a remote socket has sended data to this socket * * \param ar Async result * * \return (none) */ private void pOnReceive ( IAsyncResult ar ) { try { int iBytesRead = SocketObject.EndReceive(ar); if (null != OnReceive) this.OnReceive(this, b_Buffer, iBytesRead); // b_Buffer = new byte[BufferSize]; m_oSocket.BeginReceive(b_Buffer, 0, BufferSize, SocketFlags.None, new AsyncCallback(this.pOnReceive), m_oSocket); } catch (Exception e) { pOnError(e); } return; } /*! \fn private void pOnError ( Exception e ) * \brief Is invoked if an error occurred * * \param ar Async result * * \return (none) */ private void pOnError ( Exception e ) { if (null != OnError) this.OnError(this, e); return; } /*! \fn private void pOnConnectWithRemote ( IAsyncResult ar ) * \brief Is invoked if an connection with a remote established * * \param ar Async result * * \return (none) */ private void pOnConnectWithRemote ( IAsyncResult ar ) { SocketObject.EndConnect(ar); if (null != OnConnectWithRemote) this.OnConnectWithRemote(this, m_oSocket); return; } } |
From: Marcel K. <gen...@us...> - 2005-03-05 10:36:28
|
Update of /cvsroot/delivery-boy/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14590 Added Files: GPL.txt Readme.txt Log Message: - Added classes: Global, clsEasySocket and clsEasyTCPServer - Added GPL License & Readme.txt - Added some functions, like menu browsing or starting the server (incl. event) to the MainClass --- NEW FILE: GPL.txt --- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. --- NEW FILE: Readme.txt --- - To use with Mono: Set enviroment var MONO_EXTERNAL_ENCODINGS=default_locale |
From: Marcel K. <gen...@us...> - 2005-03-05 10:31:53
|
Update of /cvsroot/delivery-boy/server/DeliveryBoyS/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13477/classes Log Message: Directory /cvsroot/delivery-boy/server/DeliveryBoyS/classes added to the repository |
From: Marcel K. <gen...@us...> - 2005-03-05 10:29:58
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12929/DeliveryBoyC/classes Modified Files: clsEasyTCPServer.cs Log Message: - clsEasyTCPServer class now works Index: clsEasyTCPServer.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/classes/clsEasyTCPServer.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** clsEasyTCPServer.cs 13 Feb 2005 16:46:53 -0000 1.5 --- clsEasyTCPServer.cs 5 Mar 2005 10:29:43 -0000 1.6 *************** *** 45,48 **** --- 45,51 ---- * \note * $Log$ + * Revision 1.6 2005/03/05 10:29:43 generalpd + * - clsEasyTCPServer class now works + * * Revision 1.5 2005/02/13 16:46:53 generalpd * - moved application run code to seperate method Run() *************** *** 85,89 **** /// Connections ! private ArrayList m_oConnections = null; /// Accept-Event-Handler-Struct --- 88,92 ---- /// Connections ! private clsEasySocket[] m_oConnections; /// Accept-Event-Handler-Struct *************** *** 91,94 **** --- 94,101 ---- /// Accept-Event-Handler public event AcceptHandler OnAccept; + /// Receive-Event-Handler-Struct + public delegate void ReceiveHandler(System.Object sender, clsEasySocket socket, System.Byte[] buffer, System.Int32 bytes_read); + /// Receive-Event-Handler + public event ReceiveHandler OnReceive; /*! \fn public clsEasyTCPServer *************** *** 103,108 **** //ListenQueue = m_oListenSocket.ListenQueue; MaxConnections = 0; - - m_oConnections = new ArrayList(); } --- 110,113 ---- *************** *** 118,142 **** get { ! Int32 i = 0; ! ArrayList oBuffer = new ArrayList(); ! ! clsEasySocket oSocketBuffer = null; ! ! for (i = 0; i < m_oConnections.Count; i++) ! { ! oSocketBuffer = (clsEasySocket)m_oConnections[i]; ! ! if ( oSocketBuffer.Connected ) ! oBuffer.Add(oSocketBuffer); ! } ! ! m_oConnections = oBuffer; ! ! // create a new temporary array and copy all stuff from the ArrayList to the temp array ! // for return ! clsEasySocket[] o_es_buffer = new clsEasySocket[m_oConnections.Count]; ! oBuffer.CopyTo(o_es_buffer); ! ! return o_es_buffer; } } --- 123,127 ---- get { ! return m_oConnections; } } *************** *** 158,162 **** set { ! m_ui32MaxConnections = value; } } --- 143,154 ---- set { ! int i = 0; ! ! m_ui32MaxConnections = value; ! ! m_oConnections = new clsEasySocket[m_ui32MaxConnections]; ! ! for (i = 0; i < m_oConnections.GetLength(0); i++) ! m_oConnections[i] = new clsEasySocket(); } } *************** *** 264,268 **** // init timer and start it ! m_oTimer = new Timer(250); m_oTimer.Elapsed += new ElapsedEventHandler(this.TimerElapsed); m_oTimer.Start(); --- 256,260 ---- // init timer and start it ! m_oTimer = new Timer(125); m_oTimer.Elapsed += new ElapsedEventHandler(this.TimerElapsed); m_oTimer.Start(); *************** *** 332,335 **** --- 324,329 ---- if (m_oListenSocket.Pending()) { + int i = 0; + bool boolIsFull = true; Socket s = m_oListenSocket.AcceptSocket(); *************** *** 338,347 **** if (s.Connected) ! m_oConnections.Add( new clsEasySocket(s) ); ! Console.WriteLine(m_oConnections.Count.ToString()); } return; } } --- 332,371 ---- if (s.Connected) ! { ! for (i = 0; i < m_oConnections.GetLength(0); i++) ! { ! if (!m_oConnections[i].Connected) ! { ! m_oConnections[i] = new clsEasySocket(s); ! m_oConnections[i].OnReceive += new clsEasySocket.ReceiveHandler(ReceiveData); ! boolIsFull = false; ! break; ! } ! } ! ! if (boolIsFull) ! s.Close(); ! } } return; } + + /*! \fn private void ReceiveData (System.Object sender, System.Byte[] buffer, System.Int32 bytes_read); + * \brief Data ready for read + * + * \param sender This timer instance + * \param buffer Data + * \param bytes_read # of bytes that are ready for reading + * + * \return (none) + */ + private void ReceiveData (System.Object sender, System.Byte[] buffer, System.Int32 bytes_read) + { + if (null != OnReceive) + OnReceive(this, (clsEasySocket)sender, buffer, bytes_read); + + return; + } } |
From: Marcel K. <gen...@us...> - 2005-02-13 16:55:49
|
Update of /cvsroot/delivery-boy/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2640 Added Files: GPL.txt Log Message: - added the GPL license to the repository --- NEW FILE: GPL.txt --- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. |
From: Marcel K. <gen...@us...> - 2005-02-13 16:47:12
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31071/DeliveryBoyC/classes Modified Files: clsEasySocket.cs clsEasyTCPServer.cs Log Message: - moved application run code to seperate method Run() - created 2 clsEasySocket Constructors and moved init code for this class to seperate private method - clsEasyTCPServer now uses an instance of TcpListener - also added events for connected and so on - added Global class Index: clsEasyTCPServer.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/classes/clsEasyTCPServer.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** clsEasyTCPServer.cs 5 Feb 2005 00:08:30 -0000 1.4 --- clsEasyTCPServer.cs 13 Feb 2005 16:46:53 -0000 1.5 *************** *** 24,27 **** --- 24,29 ---- using System; using System.Collections; + using System.Net.Sockets; + using System.Timers; /*! \class clsEasyTCPServer clsEasyTCPServer.cs "clsEasyTCPServer.cs" *************** *** 43,46 **** --- 45,55 ---- * \note * $Log$ + * Revision 1.5 2005/02/13 16:46:53 generalpd + * - moved application run code to seperate method Run() + * - created 2 clsEasySocket Constructors and moved init code for this class to seperate private method + * - clsEasyTCPServer now uses an instance of TcpListener + * - also added events for connected and so on + * - added Global class + * * Revision 1.4 2005/02/05 00:08:30 generalpd * - removed socket sample code *************** *** 60,70 **** * */ ! public class clsEasyTCPServer { ! /// Default listen queue size ! private const Int32 DEFAULT_LISTENQUEUE_SIZE = 16; ! /// Listen socket ! private clsEasySocket m_oListenSocket; /// Local port private Int32 m_i32Port = -1; --- 69,78 ---- * */ ! public class clsEasyTCPServer { ! /// Timer ! private Timer m_oTimer = null; /// Listen socket ! private TcpListener m_oListenSocket = null; /// Local port private Int32 m_i32Port = -1; *************** *** 73,79 **** /// Listen queue size private Int32 m_i32ListenQueue = -1; /// Connections ! private ArrayList m_oConnections = null; /*! \fn public clsEasyTCPServer --- 81,94 ---- /// Listen queue size private Int32 m_i32ListenQueue = -1; + /// Maximum connections + private UInt32 m_ui32MaxConnections = 0; /// Connections ! private ArrayList m_oConnections = null; ! ! /// Accept-Event-Handler-Struct ! public delegate void AcceptHandler(System.Object sender, System.Net.Sockets.Socket socket); ! /// Accept-Event-Handler ! public event AcceptHandler OnAccept; /*! \fn public clsEasyTCPServer *************** *** 86,96 **** public clsEasyTCPServer() { ! m_oListenSocket = null; ! Port = 0; ! ListenQueue = DEFAULT_LISTENQUEUE_SIZE; m_oConnections = new ArrayList(); } /*! \property public Int32 ListenQueue * \brief Returns the size of the listen queue or sets it. --- 101,165 ---- public clsEasyTCPServer() { ! //ListenQueue = m_oListenSocket.ListenQueue; ! MaxConnections = 0; m_oConnections = new ArrayList(); } + /*! \property public UInt32 Connections + * \brief Returns all availible clsEasySocket connections. + * + * \param (none) + * + * \return List of all connections + */ + public clsEasySocket[] Connections + { + get + { + Int32 i = 0; + ArrayList oBuffer = new ArrayList(); + + clsEasySocket oSocketBuffer = null; + + for (i = 0; i < m_oConnections.Count; i++) + { + oSocketBuffer = (clsEasySocket)m_oConnections[i]; + + if ( oSocketBuffer.Connected ) + oBuffer.Add(oSocketBuffer); + } + + m_oConnections = oBuffer; + + // create a new temporary array and copy all stuff from the ArrayList to the temp array + // for return + clsEasySocket[] o_es_buffer = new clsEasySocket[m_oConnections.Count]; + oBuffer.CopyTo(o_es_buffer); + + return o_es_buffer; + } + } + + /*! \property public UInt32 MaxConnections + * \brief Returns the size of maximum server connections or sets it. + * + * \param value New size (0 => unlimited) + * + * \return Maximum connections (0 => unlimited) + */ + public UInt32 MaxConnections + { + get + { + return m_ui32MaxConnections; + } + + set + { + m_ui32MaxConnections = value; + } + } + /*! \property public Int32 ListenQueue * \brief Returns the size of the listen queue or sets it. *************** *** 129,134 **** set { ! m_oListenSocket.LocalPort = value; ! m_i32Port = m_oListenSocket.LocalPort; } } --- 198,203 ---- set { ! m_i32Port = value; ! InitListenSocket(); } } *************** *** 145,149 **** get { ! return m_oListenSocket.Connected; } } --- 214,219 ---- get { ! // return m_oListenSocket.Connected; ! return true; } } *************** *** 163,182 **** try { ! if (!Listening) ! { ! // not listening ! return SetLastException(2, null); ! } ! else ! { ! if ( 0 == m_oListenSocket.Close()) ! { ! m_oListenSocket = null; ! return SetLastException(0, null); ! } ! else ! // socket error ! return SetLastException(3, m_oListenSocket.LastException); ! } } catch (Exception e) --- 233,241 ---- try { ! m_oTimer.Stop(); ! m_oTimer = null; ! m_oListenSocket.Stop(); ! ! return SetLastException(0, null); } catch (Exception e) *************** *** 200,231 **** try { ! if (Listening) ! { ! m_oListenSocket = null; ! ! // already listening ! return SetLastException(2, null); ! } ! else ! { ! m_oListenSocket = new clsEasySocket(); ! m_oListenSocket.LocalPort = Port; ! m_oListenSocket.ListenQueue = DEFAULT_LISTENQUEUE_SIZE; ! ! if ( 0 == m_oListenSocket.Listen()) ! return SetLastException(0, null); ! else ! { ! m_oListenSocket = null; ! ! // socket error ! return SetLastException(3, m_oListenSocket.LastException); ! } ! } } catch (Exception e) { - m_oListenSocket = null; - return SetLastException(1, e); } --- 259,275 ---- try { ! // Init listener and start it ! InitListenSocket(); ! m_oListenSocket.Start(); ! ! // init timer and start it ! m_oTimer = new Timer(250); ! m_oTimer.Elapsed += new ElapsedEventHandler(this.TimerElapsed); ! m_oTimer.Start(); ! ! return SetLastException(0, null); } catch (Exception e) { return SetLastException(1, e); } *************** *** 261,263 **** --- 305,347 ---- return ui32_ErrorCode; } + + /*! \fn private void InitListenSocket () + * \brief Inits the listening socket with all stuff + * + * \param (none) + * + * \return (none) + */ + private void InitListenSocket () + { + m_oListenSocket = new TcpListener(Port); + + return; + } + + /*! \fn private void TimerElapsed (object sender, ElapsedEventArgs e); + * \brief Timer elapsed + * + * \param sender This timer instance + * \param ElapsedEventArgs Arguments + * + * \return (none) + */ + private void TimerElapsed (object sender, ElapsedEventArgs e) + { + if (m_oListenSocket.Pending()) + { + Socket s = m_oListenSocket.AcceptSocket(); + + if (null != OnAccept) + OnAccept(this, s); + + if (s.Connected) + m_oConnections.Add( new clsEasySocket(s) ); + + Console.WriteLine(m_oConnections.Count.ToString()); + } + + return; + } } Index: clsEasySocket.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/classes/clsEasySocket.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** clsEasySocket.cs 5 Feb 2005 00:08:30 -0000 1.10 --- clsEasySocket.cs 13 Feb 2005 16:46:53 -0000 1.11 *************** *** 43,46 **** --- 43,53 ---- * \note * $Log$ + * Revision 1.11 2005/02/13 16:46:53 generalpd + * - moved application run code to seperate method Run() + * - created 2 clsEasySocket Constructors and moved init code for this class to seperate private method + * - clsEasyTCPServer now uses an instance of TcpListener + * - also added events for connected and so on + * - added Global class + * * Revision 1.10 2005/02/05 00:08:30 generalpd * - removed socket sample code *************** *** 125,133 **** public clsEasySocket() { // initialize all necessary vars m_oASCII = new ASCIIEncoding(); - m_oSocket = new Socket(c_AddressFamily, c_SocketType, c_ProtocolType); - RemoteAddress = "0.0.0.0"; RemotePort = 0; --- 132,166 ---- public clsEasySocket() { + m_oSocket = new Socket(c_AddressFamily, c_SocketType, c_ProtocolType); + + InitRest(); + } + + /*! \fn clsEasySocket + * \brief Inits all necessary stuff + * + * \param socket + * + * \return (none) + */ + public clsEasySocket(Socket socket) + { + m_oSocket = socket; + + InitRest(); + } + + /*! \fn private void InitRest () + * \brief Inits the rest + * + * \param (none) + * + * \return (none) + */ + private void InitRest () + { // initialize all necessary vars m_oASCII = new ASCIIEncoding(); RemoteAddress = "0.0.0.0"; RemotePort = 0; |
From: Marcel K. <gen...@us...> - 2005-02-13 16:47:07
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31071/DeliveryBoyC Modified Files: DeliveryBoyC.prjx Main.cs Added Files: Global.cs Log Message: - moved application run code to seperate method Run() - created 2 clsEasySocket Constructors and moved init code for this class to seperate private method - clsEasyTCPServer now uses an instance of TcpListener - also added events for connected and so on - added Global class Index: DeliveryBoyC.prjx =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/DeliveryBoyC.prjx,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DeliveryBoyC.prjx 4 Feb 2005 22:43:03 -0000 1.6 --- DeliveryBoyC.prjx 13 Feb 2005 16:46:53 -0000 1.7 *************** *** 6,25 **** <File name=".\classes\clsEasySocket.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\classes\clsEasyTCPServer.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References /> <DeploymentInformation target="" script="" strategy="File" /> ! <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MonoInterpreter" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="True" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> ! <Output directory="..\..\bin\Release" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> ! <Configurations active="Release"> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MonoInterpreter" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Debug" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MonoInterpreter" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="True" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Release" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> --- 6,26 ---- <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> <References /> <DeploymentInformation target="" script="" strategy="File" /> ! <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MonoInterpreter" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> ! <Output directory="..\..\bin\Debug" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> ! <Configurations active="Debug"> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MonoInterpreter" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Debug" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MonoInterpreter" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Release" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> --- NEW FILE: Global.cs --- // DeliveryBoy (Client) - FLAC file sharing tool for .NET // http://deliveryboy.sourceforge.net // // // Copyright (C) 2005 Marcel Joachim Kloubert // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // using System; /*! \class Global Global.cs "Global.cs" * * \brief Global * * This abstract class contains global stuff * * \author generalpd * * \date 2005-02-10 * * \bug (none) * * \remarks Last changed by: $Author: generalpd $ in revision $Revision: 1.1 $ on $Date: 2005/02/13 16:46:53 $ * * \todo (none) * * \note * $Log: Global.cs,v $ * Revision 1.1 2005/02/13 16:46:53 generalpd * - moved application run code to seperate method Run() * - created 2 clsEasySocket Constructors and moved init code for this class to seperate private method * - clsEasyTCPServer now uses an instance of TcpListener * - also added events for connected and so on * - added Global class * * */ public abstract class clsGlobal : System.Object { /// Name of this application private static string m_strAppName = "DeliveryBoy (Client)"; /// Version of this application private static string m_strVersion = "0.01"; /// Kind of version (alpha, beta, stable / etc.) private static string m_strVersionKind = "pre-alpha"; public static string CompleteAppName { get { return m_strAppName + " v" + m_strVersion + " " + m_strVersionKind; } } } Index: Main.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/Main.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Main.cs 5 Feb 2005 00:08:28 -0000 1.9 --- Main.cs 13 Feb 2005 16:46:53 -0000 1.10 *************** *** 23,26 **** --- 23,27 ---- using System.Net; using System.Net.Sockets; + using System.Reflection; namespace DeliveryBoyC *************** *** 44,47 **** --- 45,55 ---- * \note * $Log$ + * Revision 1.10 2005/02/13 16:46:53 generalpd + * - moved application run code to seperate method Run() + * - created 2 clsEasySocket Constructors and moved init code for this class to seperate private method + * - clsEasyTCPServer now uses an instance of TcpListener + * - also added events for connected and so on + * - added Global class + * * Revision 1.9 2005/02/05 00:08:28 generalpd * - removed socket sample code *************** *** 72,80 **** public static int Main(string[] args) { try { bool bool_ExitDoWhile = false; string str_ConsoleInput = ""; ! PrintHeader(); --- 80,104 ---- public static int Main(string[] args) { + MainClass TheDBApp = new MainClass(); + + return TheDBApp.Run(); + } + + /*! \fn protected int Run () + * \brief Runs the application + * + * \param (none) + * + * \return Error code: + * 0 => No error + * 1 => Exception + */ + protected int Run () + { try { bool bool_ExitDoWhile = false; string str_ConsoleInput = ""; ! PrintHeader(); *************** *** 107,115 **** catch (Exception e) { return 1; } ! } ! /*! \fn private void PrintHeader () * \brief Prints the app name & version to the screen * --- 131,142 ---- catch (Exception e) { + Console.WriteLine(e.Message); + return 1; } ! } ! ! /*! \fn private void PrintHeader () * \brief Prints the app name & version to the screen * *************** *** 118,124 **** * \return (none) */ ! private static void PrintHeader () { ! Console.WriteLine("DeliveryBoy (Client) v0.01pre-alpha"); Console.WriteLine("----------------------------------------"); --- 145,151 ---- * \return (none) */ ! private void PrintHeader () { ! Console.WriteLine(clsGlobal.CompleteAppName); Console.WriteLine("----------------------------------------"); *************** *** 133,137 **** * \return (none) */ ! private static void PrintHelp () { Console.WriteLine(""); --- 160,164 ---- * \return (none) */ ! private void PrintHelp () { Console.WriteLine(""); |
From: Marcel K. <gen...@us...> - 2005-02-05 00:09:09
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32120/DeliveryBoyC Modified Files: Main.cs Log Message: - removed socket sample code - bugfix in clsEasySocket: set socket to non-blocking at initializing - added some important funcs and properties Index: Main.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/Main.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Main.cs 4 Feb 2005 22:33:20 -0000 1.8 --- Main.cs 5 Feb 2005 00:08:28 -0000 1.9 *************** *** 44,47 **** --- 44,52 ---- * \note * $Log$ + * Revision 1.9 2005/02/05 00:08:28 generalpd + * - removed socket sample code + * - bugfix in clsEasySocket: set socket to non-blocking at initializing + * - added some important funcs and properties + * * Revision 1.8 2005/02/04 22:33:20 generalpd * - changed combine options: Compiler is Mono and Runtime-Env is Microsoft .NET *************** *** 58,62 **** class MainClass { ! /*! \fn public static void Main(string[] args) * \brief Entry point. * --- 63,67 ---- class MainClass { ! /*! \fn public static int Main(string[] args) * \brief Entry point. * *************** *** 65,117 **** * \return (none) */ ! public static void Main(string[] args) { ! // clsEasySocket a = new clsEasySocket(); ! bool bool_ExitDoWhile = false; ! string str_ConsoleInput = ""; ! PrintHeader(); ! /* sample socket test: */ ! ! /* a.OnConnectWithRemote += new clsEasySocket.ConnectHandler(SocketConnected); ! // a.LocalPort = 23; ! a.RemoteAddress = "localhost"; ! a.RemotePort = 23; ! Console.WriteLine(a.Connect()); */ ! /* ! if (0 == a.Listen()) ! { ! Console.WriteLine("OK!"); } ! else ! Console.WriteLine("ERROR!"); */ ! ! do { ! Console.Write("> "); ! str_ConsoleInput = Console.ReadLine(); ! ! switch (str_ConsoleInput.Trim()) ! { ! // Exit application ! case "q": ! bool_ExitDoWhile = true; ! break; ! ! // Print help menu ! case "?": ! PrintHelp(); ! break; ! } } - while (!bool_ExitDoWhile); - - // Clear all - GC.Collect(); - GC.WaitForPendingFinalizers(); - return; } --- 70,112 ---- * \return (none) */ ! public static int Main(string[] args) { ! try ! { ! bool bool_ExitDoWhile = false; ! string str_ConsoleInput = ""; ! PrintHeader(); ! do ! { ! Console.Write("> "); ! str_ConsoleInput = Console.ReadLine(); ! ! switch (str_ConsoleInput.Trim()) ! { ! // Exit application ! case "q": ! bool_ExitDoWhile = true; ! break; ! ! // Print help menu ! case "?": ! PrintHelp(); ! break; ! } ! } ! while (!bool_ExitDoWhile); ! // Clear all ! GC.Collect(); ! GC.WaitForPendingFinalizers(); ! return 0; } ! catch (Exception e) { ! return 1; } } *************** *** 147,162 **** return; } - - // sample event for socket - /* - public static void SocketConnected (System.Object sender, System.Net.Sockets.Socket socket) - { - - - Console.WriteLine("COOL!"); - - return; - } - */ } } --- 142,145 ---- |
From: Marcel K. <gen...@us...> - 2005-02-05 00:08:49
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32120/DeliveryBoyC/classes Modified Files: clsEasySocket.cs clsEasyTCPServer.cs Log Message: - removed socket sample code - bugfix in clsEasySocket: set socket to non-blocking at initializing - added some important funcs and properties Index: clsEasyTCPServer.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/classes/clsEasyTCPServer.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** clsEasyTCPServer.cs 4 Feb 2005 22:33:20 -0000 1.3 --- clsEasyTCPServer.cs 5 Feb 2005 00:08:30 -0000 1.4 *************** *** 23,26 **** --- 23,27 ---- using System; + using System.Collections; /*! \class clsEasyTCPServer clsEasyTCPServer.cs "clsEasyTCPServer.cs" *************** *** 42,45 **** --- 43,51 ---- * \note * $Log$ + * Revision 1.4 2005/02/05 00:08:30 generalpd + * - removed socket sample code + * - bugfix in clsEasySocket: set socket to non-blocking at initializing + * - added some important funcs and properties + * * Revision 1.3 2005/02/04 22:33:20 generalpd * - changed combine options: Compiler is Mono and Runtime-Env is Microsoft .NET *************** *** 56,64 **** public class clsEasyTCPServer { ! clsEasySocket[] m_oSockets; public clsEasyTCPServer() { ! m_oSockets = new clsEasySocket[0]; } } --- 62,263 ---- public class clsEasyTCPServer { ! /// Default listen queue size ! private const Int32 DEFAULT_LISTENQUEUE_SIZE = 16; ! ! /// Listen socket ! private clsEasySocket m_oListenSocket; ! /// Local port ! private Int32 m_i32Port = -1; ! /// Last occurred exception ! private Exception m_oLastException = null; ! /// Listen queue size ! private Int32 m_i32ListenQueue = -1; + /// Connections + private ArrayList m_oConnections = null; + + /*! \fn public clsEasyTCPServer + * \brief Inits all necessary stuff + * + * \param (none) + * + * \return (none) + */ public clsEasyTCPServer() { ! m_oListenSocket = null; ! Port = 0; ! ListenQueue = DEFAULT_LISTENQUEUE_SIZE; ! ! m_oConnections = new ArrayList(); ! } ! ! /*! \property public Int32 ListenQueue ! * \brief Returns the size of the listen queue or sets it. ! * ! * \param value New size ! * ! * \return Size of listen queue ! */ ! public Int32 ListenQueue ! { ! get ! { ! return m_i32ListenQueue; ! } ! ! set ! { ! m_i32ListenQueue = value; ! } ! } ! ! /*! \fn public Int32 Port ! * \brief Return or set the port of this server ! * ! * \param value New port ! * ! * \return Port ! */ ! public Int32 Port ! { ! get ! { ! return m_i32Port; ! } ! ! set ! { ! m_oListenSocket.LocalPort = value; ! m_i32Port = m_oListenSocket.LocalPort; ! } ! } ! ! /*! \fn public bool Listening ! * \brief Return if this server is listening ! * ! * \param (none) ! * ! * \return Is listening (true) or not (false) ! */ ! public bool Listening ! { ! get ! { ! return m_oListenSocket.Connected; ! } ! } ! ! /*! \fn public UInt32 Stop () ! * \brief Stops the server. ! * ! * \param (none) ! * ! * \return Error code:<BR> ! * 0 => no error<BR> ! * 1 => general exception<BR> ! * 2 => not listening ! */ ! public UInt32 Stop () ! { ! try ! { ! if (!Listening) ! { ! // not listening ! return SetLastException(2, null); ! } ! else ! { ! if ( 0 == m_oListenSocket.Close()) ! { ! m_oListenSocket = null; ! return SetLastException(0, null); ! } ! else ! // socket error ! return SetLastException(3, m_oListenSocket.LastException); ! } ! } ! catch (Exception e) ! { ! return SetLastException(1, e); ! } ! } ! ! /*! \fn public UInt32 Start () ! * \brief Starts the server. ! * ! * \param (none) ! * ! * \return Error code:<BR> ! * 0 => no error<BR> ! * 1 => general exception<BR> ! * 2 => already listening ! */ ! public UInt32 Start () ! { ! try ! { ! if (Listening) ! { ! m_oListenSocket = null; ! ! // already listening ! return SetLastException(2, null); ! } ! else ! { ! m_oListenSocket = new clsEasySocket(); ! m_oListenSocket.LocalPort = Port; ! m_oListenSocket.ListenQueue = DEFAULT_LISTENQUEUE_SIZE; ! ! if ( 0 == m_oListenSocket.Listen()) ! return SetLastException(0, null); ! else ! { ! m_oListenSocket = null; ! ! // socket error ! return SetLastException(3, m_oListenSocket.LastException); ! } ! } ! } ! catch (Exception e) ! { ! m_oListenSocket = null; ! ! return SetLastException(1, e); ! } ! } ! ! /*! \property public Exception LastException ! * \brief Returns the last occurred exception. ! * ! * \param (none) ! * ! * \return Exception object (null => no error) ! */ ! public Exception LastException ! { ! get ! { ! return m_oLastException; ! } ! } ! ! /*! \fn private UInt32 SetLastException (UInt32 ui32_ErrorCode, Exception oNewException) ! * \brief Sets the last occurred exception. ! * ! * \param ui32_ErrorCode Error code. ! * \param oNewException The new exception object. ! * ! * \return Error code submitted by ui32_ErrorCode ! */ ! private UInt32 SetLastException (UInt32 ui32_ErrorCode, Exception oNewException) ! { ! m_oLastException = oNewException; ! ! return ui32_ErrorCode; } } Index: clsEasySocket.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/classes/clsEasySocket.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** clsEasySocket.cs 4 Feb 2005 20:20:39 -0000 1.9 --- clsEasySocket.cs 5 Feb 2005 00:08:30 -0000 1.10 *************** *** 43,46 **** --- 43,51 ---- * \note * $Log$ + * Revision 1.10 2005/02/05 00:08:30 generalpd + * - removed socket sample code + * - bugfix in clsEasySocket: set socket to non-blocking at initializing + * - added some important funcs and properties + * * Revision 1.9 2005/02/04 20:20:39 generalpd * - changed from * to - to define a point *************** *** 57,60 **** --- 62,67 ---- /// Default buffer size in byte private const Int32 DEFAULT_BUFFER_SIZE = 1024; + /// Default listen queue size + private const Int32 DEFAULT_LISTENQUEUE_SIZE = 16; /// Byte buffer *************** *** 125,131 **** RemoteAddress = "0.0.0.0"; RemotePort = 0; ! ListenQueue = 1; BufferSize = DEFAULT_BUFFER_SIZE; AutoAccept = true; b_Buffer = new byte[BufferSize]; --- 132,139 ---- RemoteAddress = "0.0.0.0"; RemotePort = 0; ! ListenQueue = DEFAULT_LISTENQUEUE_SIZE; BufferSize = DEFAULT_BUFFER_SIZE; AutoAccept = true; + SocketObject.Blocking = false; b_Buffer = new byte[BufferSize]; *************** *** 243,247 **** * \return Socket object */ ! public Socket SocketObject { get --- 251,255 ---- * \return Socket object */ ! public System.Net.Sockets.Socket SocketObject { get *************** *** 363,366 **** --- 371,375 ---- else { + SocketObject.Shutdown(SocketShutdown.Both); SocketObject.Close(); *************** *** 558,562 **** { int iBytesRead = SocketObject.EndReceive(ar); ! if (null != OnReceive) this.OnReceive(this, b_Buffer, iBytesRead); --- 567,571 ---- { int iBytesRead = SocketObject.EndReceive(ar); ! if (null != OnReceive) this.OnReceive(this, b_Buffer, iBytesRead); |
From: Marcel K. <gen...@us...> - 2005-02-04 22:43:12
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13440/DeliveryBoyC Modified Files: DeliveryBoyC.prjx Log Message: - set new compiler options: set runtime-env and compiler to Mono - added Readme.txt Index: DeliveryBoyC.prjx =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/DeliveryBoyC.prjx,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DeliveryBoyC.prjx 4 Feb 2005 22:33:20 -0000 1.5 --- DeliveryBoyC.prjx 4 Feb 2005 22:43:03 -0000 1.6 *************** *** 10,14 **** <DeploymentInformation target="" script="" strategy="File" /> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MsNet" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="True" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Release" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> --- 10,14 ---- <DeploymentInformation target="" script="" strategy="File" /> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MonoInterpreter" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="True" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Release" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> *************** *** 16,25 **** <Configurations active="Release"> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Debug" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MsNet" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="True" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Release" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> --- 16,25 ---- <Configurations active="Release"> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MonoInterpreter" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Debug" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MonoInterpreter" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="True" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Release" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> |
From: Marcel K. <gen...@us...> - 2005-02-04 22:43:11
|
Update of /cvsroot/delivery-boy/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13440 Added Files: Readme.txt Log Message: - set new compiler options: set runtime-env and compiler to Mono - added Readme.txt --- NEW FILE: Readme.txt --- - To use with Mono: Set enviroment var MONO_EXTERNAL_ENCODINGS=default_locale |
From: Marcel K. <gen...@us...> - 2005-02-04 22:33:31
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11360/DeliveryBoyC Modified Files: AssemblyInfo.cs DeliveryBoyC.prjx Main.cs Log Message: - changed combine options: Compiler is Mono and Runtime-Env is Microsoft .NET Index: DeliveryBoyC.prjx =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/DeliveryBoyC.prjx,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DeliveryBoyC.prjx 4 Feb 2005 20:13:36 -0000 1.4 --- DeliveryBoyC.prjx 4 Feb 2005 22:33:20 -0000 1.5 *************** *** 1,3 **** ! <Project name="DeliveryBoyC" standardNamespace="DeliveryBoyC" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#"> <Contents> <File name=".\Main.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> --- 1,3 ---- ! <Project name="DeliveryBoyC" standardNamespace="DeliveryBoyC" description="FLAC file sharing tool for .NET" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#"> <Contents> <File name=".\Main.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> *************** *** 9,25 **** <References /> <DeploymentInformation target="" script="" strategy="File" /> ! <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> ! <Output directory="..\..\bin\Debug" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> ! <Configurations active="Debug"> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Debug" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Release" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> --- 9,25 ---- <References /> <DeploymentInformation target="" script="" strategy="File" /> ! <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MsNet" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="True" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> ! <Output directory="..\..\bin\Release" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> ! <Configurations active="Release"> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Debug" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MsNet" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="True" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Release" assembly="DeliveryBoyC" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> Index: Main.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/Main.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Main.cs 4 Feb 2005 20:20:38 -0000 1.7 --- Main.cs 4 Feb 2005 22:33:20 -0000 1.8 *************** *** 44,47 **** --- 44,50 ---- * \note * $Log$ + * Revision 1.8 2005/02/04 22:33:20 generalpd + * - changed combine options: Compiler is Mono and Runtime-Env is Microsoft .NET + * * Revision 1.7 2005/02/04 20:20:38 generalpd * - changed from * to - to define a point *************** *** 65,69 **** { // clsEasySocket a = new clsEasySocket(); ! bool bool_ExitDoWhile = false; string str_ConsoleInput = ""; --- 68,72 ---- { // clsEasySocket a = new clsEasySocket(); ! bool bool_ExitDoWhile = false; string str_ConsoleInput = ""; *************** *** 73,81 **** /* sample socket test: */ ! /* a.OnConnect += new clsEasySocket.ConnectHandler(SocketConnected); // a.LocalPort = 23; a.RemoteAddress = "localhost"; a.RemotePort = 23; ! a.Connect(); */ /* --- 76,84 ---- /* sample socket test: */ ! /* a.OnConnectWithRemote += new clsEasySocket.ConnectHandler(SocketConnected); // a.LocalPort = 23; a.RemoteAddress = "localhost"; a.RemotePort = 23; ! Console.WriteLine(a.Connect()); */ /* *************** *** 145,156 **** } ! // sample event /* public static void SocketConnected (System.Object sender, System.Net.Sockets.Socket socket) ! { Console.WriteLine("COOL!"); return; ! } */ } } --- 148,162 ---- } ! // sample event for socket /* public static void SocketConnected (System.Object sender, System.Net.Sockets.Socket socket) ! { ! ! Console.WriteLine("COOL!"); return; ! } ! */ } } Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/AssemblyInfo.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AssemblyInfo.cs 30 Jan 2005 23:32:20 -0000 1.2 --- AssemblyInfo.cs 4 Feb 2005 22:33:20 -0000 1.3 *************** *** 1,2 **** --- 1,36 ---- + // DeliveryBoy (Client) - FLAC file sharing tool for .NET + // http://deliveryboy.sourceforge.net + // + // + // Copyright (C) 2005 Marcel Joachim Kloubert + // + // This program is free software; you can redistribute it and/or + // modify it under the terms of the GNU General Public License + // as published by the Free Software Foundation; either version 2 + // of the License, or (at your option) any later version. + // + // This program is distributed in the hope that it will be useful, + // but WITHOUT ANY WARRANTY; without even the implied warranty of + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + // GNU General Public License for more details. + // + // You should have received a copy of the GNU General Public License + // along with this program; if not, write to the Free Software + // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + // + + // + // \author generalpd + // + // \remarks Last changed by: $Author$ in Revision $Revision$ on $Date$ + // + // \note + // $Log$ + // Revision 1.3 2005/02/04 22:33:20 generalpd + // - changed combine options: Compiler is Mono and Runtime-Env is Microsoft .NET + // + // + + using System.Reflection; using System.Runtime.CompilerServices; |
From: Marcel K. <gen...@us...> - 2005-02-04 22:33:31
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11360/DeliveryBoyC/classes Modified Files: clsEasyTCPServer.cs Log Message: - changed combine options: Compiler is Mono and Runtime-Env is Microsoft .NET Index: clsEasyTCPServer.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/classes/clsEasyTCPServer.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** clsEasyTCPServer.cs 4 Feb 2005 20:20:39 -0000 1.2 --- clsEasyTCPServer.cs 4 Feb 2005 22:33:20 -0000 1.3 *************** *** 42,45 **** --- 42,48 ---- * \note * $Log$ + * Revision 1.3 2005/02/04 22:33:20 generalpd + * - changed combine options: Compiler is Mono and Runtime-Env is Microsoft .NET + * * Revision 1.2 2005/02/04 20:20:39 generalpd * - changed from * to - to define a point *************** *** 57,61 **** public clsEasyTCPServer() { ! // m_oSockets(0). } } --- 60,64 ---- public clsEasyTCPServer() { ! m_oSockets = new clsEasySocket[0]; } } |
From: Marcel K. <gen...@us...> - 2005-02-04 20:21:08
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15178/DeliveryBoyC/classes Modified Files: clsEasySocket.cs clsEasyTCPServer.cs Log Message: - changed from * to - to define a point Index: clsEasyTCPServer.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/classes/clsEasyTCPServer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** clsEasyTCPServer.cs 4 Feb 2005 20:13:38 -0000 1.1 --- clsEasyTCPServer.cs 4 Feb 2005 20:20:39 -0000 1.2 *************** *** 42,48 **** * \note * $Log$ * Revision 1.1 2005/02/04 20:13:38 generalpd ! * * added doxygen \note command & log cvs keyword in all top headers ! * * started to create class EasyTCPServer * * --- 42,51 ---- * \note * $Log$ + * Revision 1.2 2005/02/04 20:20:39 generalpd + * - changed from * to - to define a point + * * Revision 1.1 2005/02/04 20:13:38 generalpd ! * - added doxygen \note command & log cvs keyword in all top headers ! * - started to create class EasyTCPServer * * Index: clsEasySocket.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/classes/clsEasySocket.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** clsEasySocket.cs 4 Feb 2005 20:13:37 -0000 1.8 --- clsEasySocket.cs 4 Feb 2005 20:20:39 -0000 1.9 *************** *** 43,49 **** * \note * $Log$ * Revision 1.8 2005/02/04 20:13:37 generalpd ! * * added doxygen \note command & log cvs keyword in all top headers ! * * started to create class EasyTCPServer * * --- 43,52 ---- * \note * $Log$ + * Revision 1.9 2005/02/04 20:20:39 generalpd + * - changed from * to - to define a point + * * Revision 1.8 2005/02/04 20:13:37 generalpd ! * - added doxygen \note command & log cvs keyword in all top headers ! * - started to create class EasyTCPServer * * |
From: Marcel K. <gen...@us...> - 2005-02-04 20:21:08
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15178/DeliveryBoyC Modified Files: Main.cs Log Message: - changed from * to - to define a point Index: Main.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/Main.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Main.cs 4 Feb 2005 20:13:36 -0000 1.6 --- Main.cs 4 Feb 2005 20:20:38 -0000 1.7 *************** *** 41,50 **** * * \todo Adding code. ! * * \note * $Log$ * Revision 1.6 2005/02/04 20:13:36 generalpd ! * * added doxygen \note command & log cvs keyword in all top headers ! * * started to create class EasyTCPServer * */ --- 41,53 ---- * * \todo Adding code. ! * * \note * $Log$ + * Revision 1.7 2005/02/04 20:20:38 generalpd + * - changed from * to - to define a point + * * Revision 1.6 2005/02/04 20:13:36 generalpd ! * - added doxygen \note command & log cvs keyword in all top headers ! * - started to create class EasyTCPServer * */ |
From: Marcel K. <gen...@us...> - 2005-02-04 20:13:47
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13538/DeliveryBoyC Modified Files: DeliveryBoyC.prjx Main.cs Log Message: * added doxygen \note command & log cvs keyword in all top headers * started to create class EasyTCPServer Index: DeliveryBoyC.prjx =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/DeliveryBoyC.prjx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DeliveryBoyC.prjx 3 Feb 2005 21:09:59 -0000 1.3 --- DeliveryBoyC.prjx 4 Feb 2005 20:13:36 -0000 1.4 *************** *** 5,8 **** --- 5,9 ---- <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="" /> </Contents> <References /> Index: Main.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/Main.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Main.cs 4 Feb 2005 19:59:29 -0000 1.5 --- Main.cs 4 Feb 2005 20:13:36 -0000 1.6 *************** *** 42,45 **** --- 42,51 ---- * \todo Adding code. * + * \note + * $Log$ + * Revision 1.6 2005/02/04 20:13:36 generalpd + * * added doxygen \note command & log cvs keyword in all top headers + * * started to create class EasyTCPServer + * */ |
From: Marcel K. <gen...@us...> - 2005-02-04 20:13:46
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13538/DeliveryBoyC/classes Modified Files: clsEasySocket.cs Added Files: clsEasyTCPServer.cs Log Message: * added doxygen \note command & log cvs keyword in all top headers * started to create class EasyTCPServer --- NEW FILE: clsEasyTCPServer.cs --- // DeliveryBoy (Client) - FLAC file sharing tool for .NET // http://deliveryboy.sourceforge.net // // // Copyright (C) 2005 Marcel Joachim Kloubert // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // using System; /*! \class clsEasyTCPServer clsEasyTCPServer.cs "clsEasyTCPServer.cs" * * \brief Easy-to-use TCP Server class. * * This class is a simple TCP server class that uses clsEasySocket * * \author generalpd * * \date 2005-01-30 * * \bug (none) * * \remarks Last changed by: $Author: generalpd $ in revision $Revision: 1.1 $ on $Date: 2005/02/04 20:13:38 $ * * \todo Adding methods for handling data transfer between sockets. * * \note * $Log: clsEasyTCPServer.cs,v $ * Revision 1.1 2005/02/04 20:13:38 generalpd * * added doxygen \note command & log cvs keyword in all top headers * * started to create class EasyTCPServer * * */ public class clsEasyTCPServer { clsEasySocket[] m_oSockets; public clsEasyTCPServer() { // m_oSockets(0). } } Index: clsEasySocket.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/classes/clsEasySocket.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** clsEasySocket.cs 4 Feb 2005 19:59:29 -0000 1.7 --- clsEasySocket.cs 4 Feb 2005 20:13:37 -0000 1.8 *************** *** 41,44 **** --- 41,51 ---- * \todo Adding methods for handling data transfer between sockets. * + * \note + * $Log$ + * Revision 1.8 2005/02/04 20:13:37 generalpd + * * added doxygen \note command & log cvs keyword in all top headers + * * started to create class EasyTCPServer + * + * */ |
From: Marcel K. <gen...@us...> - 2005-02-04 19:59:41
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9435/DeliveryBoyC Modified Files: Main.cs Log Message: * added event for remote connection in clsEasySocket * changed from m_oSocket.Connect() to m_oSocket.BeginConnect(...) Index: Main.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/Main.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Main.cs 3 Feb 2005 21:09:59 -0000 1.4 --- Main.cs 4 Feb 2005 19:59:29 -0000 1.5 *************** *** 55,59 **** public static void Main(string[] args) { ! /* sample socket test: clsEasySocket a = new clsEasySocket(); */ bool bool_ExitDoWhile = false; --- 55,59 ---- public static void Main(string[] args) { ! // clsEasySocket a = new clsEasySocket(); bool bool_ExitDoWhile = false; *************** *** 62,72 **** PrintHeader(); ! /* sample socket test: ! a.OnConnect += new clsEasySocket.ConnectHandler(oConnected); ! a.LocalPort = 23; ! a.ListenQueue = 10; ! if (0 == a.Listen()) { --- 62,74 ---- PrintHeader(); ! /* sample socket test: */ ! /* a.OnConnect += new clsEasySocket.ConnectHandler(SocketConnected); ! // a.LocalPort = 23; ! a.RemoteAddress = "localhost"; ! a.RemotePort = 23; ! a.Connect(); */ + /* if (0 == a.Listen()) { *************** *** 134,140 **** } ! /* sample event public static void SocketConnected (System.Object sender, System.Net.Sockets.Socket socket) { return; } */ --- 136,145 ---- } ! // sample event ! /* public static void SocketConnected (System.Object sender, System.Net.Sockets.Socket socket) { + Console.WriteLine("COOL!"); + return; } */ |
From: Marcel K. <gen...@us...> - 2005-02-04 19:59:40
|
Update of /cvsroot/delivery-boy/client/DeliveryBoyC/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9435/DeliveryBoyC/classes Modified Files: clsEasySocket.cs Log Message: * added event for remote connection in clsEasySocket * changed from m_oSocket.Connect() to m_oSocket.BeginConnect(...) Index: clsEasySocket.cs =================================================================== RCS file: /cvsroot/delivery-boy/client/DeliveryBoyC/classes/clsEasySocket.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** clsEasySocket.cs 3 Feb 2005 21:10:00 -0000 1.6 --- clsEasySocket.cs 4 Feb 2005 19:59:29 -0000 1.7 *************** *** 89,92 **** --- 89,93 ---- /// Connect-Event-Handler public event ConnectHandler OnConnect; + public event ConnectHandler OnConnectWithRemote; /// Error-Event-Handler-Struct public delegate void ErrorHandler(System.Object sender, System.Exception e); *************** *** 321,325 **** if (!Connected) { ! SocketObject.Connect(m_RemoteEndPoint); return SetLastException(0, null); --- 322,326 ---- if (!Connected) { ! SocketObject.BeginConnect(m_RemoteEndPoint, new AsyncCallback(this.pOnConnectWithRemote), SocketObject); return SetLastException(0, null); *************** *** 562,566 **** } ! /*! \fn private void pOnReceive ( IAsyncResult ar ) * \brief Is invoked if an error occurred * --- 563,567 ---- } ! /*! \fn private void pOnError ( Exception e ) * \brief Is invoked if an error occurred * *************** *** 576,578 **** --- 577,596 ---- return; } + + /*! \fn private void pOnConnectWithRemote ( IAsyncResult ar ) + * \brief Is invoked if an connection with a remote established + * + * \param ar Async result + * + * \return (none) + */ + private void pOnConnectWithRemote ( IAsyncResult ar ) + { + SocketObject.EndConnect(ar); + + if (null != OnConnectWithRemote) + this.OnConnectWithRemote(this, m_oSocket); + + return; + } } |