PageRenderTime 70ms CodeModel.GetById 67ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/Manos.IO/Manos.IO/ISocket.cs

http://github.com/jacksonh/manos
C# | 89 lines | 29 code | 9 blank | 51 comment | 0 complexity | 91fcd0a80109a9fbb03afc0d9af7b035 MD5 | raw file
 1using System;
 2using System.Net;
 3
 4namespace Manos.IO
 5{
 6	/// <summary>
 7	/// Every socket is bound to an event loop and has it's end points identified by an appropriate
 8	/// implementing class of <see cref="System.Net.EndPoint"/>.
 9	/// <seealso cref="Manos.IO.IStream{TFragment}"/>
10	/// </summary>
11	public interface ISocket<TEndPoint> : IDisposable
12		where TEndPoint : EndPoint
13	{
14		/// <summary>
15		/// Gets the address family of the socket.
16		/// </summary>
17		/// <value>
18		/// The address family.
19		/// </value>
20		AddressFamily AddressFamily {
21			get;
22		}
23		
24		/// <summary>
25		/// Gets whether this socket is connected or not.
26		/// </summary>
27		/// <value>
28		/// <c>true</c> if this socket is connected; otherwise, <c>false</c>.
29		/// </value>
30		bool IsConnected {
31			get;
32		}
33		
34		/// <summary>
35		/// Gets whether this socket is bound to a local address.
36		/// </summary>
37		/// <value>
38		/// <c>true</c> if this socket is bound; otherwise, <c>false</c>.
39		/// </value>
40		bool IsBound {
41			get;
42		}
43		
44		/// <summary>
45		/// Gets the local endpoint of the socket.
46		/// </summary>
47		/// <value>
48		/// The local endpoint.
49		/// </value>
50		TEndPoint LocalEndpoint {
51			get;
52		}
53		
54		/// <summary>
55		/// Gets the remote endpoint of the socket. This may be <c>null</c> for
56		/// unconnected or connectionless sockets.
57		/// </summary>
58		/// <value>
59		/// The remote endpoint.
60		/// </value>
61		TEndPoint RemoteEndpoint {
62			get;
63		}
64		
65		/// <summary>
66		/// Gets the context the socket is bound to.
67		/// </summary>
68		/// <value>
69		/// The context.
70		/// </value>
71		Context Context {
72			get;
73		}
74		
75		/// <summary>
76		/// Bind the socket to the specified local endpoint.
77		/// </summary>
78		/// <param name='endpoint'>
79		/// Endpoint to bind to.
80		/// </param>
81		void Bind (TEndPoint endpoint);
82		
83		/// <summary>
84		/// Close this socket and release all resources associated with it.
85		/// </summary>
86		void Close ();
87	}
88}
89