|
using System;
using SocketServerLib.SocketHandler;
namespace SocketServerLib.Server
{
/// <summary>
/// This is the class for a Client Info. Extend this class to add new properties.
/// </summary>
public class ClientInfo : IDisposable
{
/// <summary>
/// The socket client handler connected as client
/// </summary>
protected AbstractTcpSocketClientHandler abstractTcpSocketClientHandler = null;
/// <summary>
/// The string for the client identification. For default is abstractTcpSocketClientHandler.ToString()
/// </summary>
protected string clientUID = null;
/// <summary>
/// Constructor.
/// </summary>
/// <param name="abstractTcpSocketClientHandler">The socket client handler</param>
public ClientInfo(AbstractTcpSocketClientHandler abstractTcpSocketClientHandler)
{
this.abstractTcpSocketClientHandler = abstractTcpSocketClientHandler;
this.clientUID = this.abstractTcpSocketClientHandler.ToString();
}
#region Properties
/// <summary>
/// Get the underlayer socket client handler.
/// </summary>
public AbstractTcpSocketClientHandler TcpSocketClientHandler
{
get
{
return this.abstractTcpSocketClientHandler;
}
}
/// <summary>
/// Get the cient UID.
/// </summary>
public string ClientUID
{
get
{
return this.clientUID;
}
}
#endregion
/// <summary>
/// Print on string the information.
/// </summary>
/// <returns>The client information</returns>
public override string ToString()
{
if (this.abstractTcpSocketClientHandler == null)
{
return "Client Info: null";
}
return string.Format("Client Info: {0}", this.clientUID);
}
#region IDisposable Members
/// <summary>
/// Dispose the client.
/// </summary>
public void Dispose()
{
if (this.abstractTcpSocketClientHandler == null)
{
return;
}
this.abstractTcpSocketClientHandler.Dispose();
this.abstractTcpSocketClientHandler = null;
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I’m an IT Project Manager for an Italian Betting Company and over the last 2 years I acquired experience in Betting area.
I have developed code in different object oriented languages (C#, C++, Java) for more than 10 years using a set of technology such as .Net, J2EE, multithreading, etc…