PageRenderTime 41ms CodeModel.GetById 35ms app.highlight 5ms RepoModel.GetById 0ms app.codeStats 0ms

/src/Fijo.Net/Services/Socket/SocketService.cs

https://bitbucket.org/Fijo/clusterconcept
C# | 25 lines | 22 code | 3 blank | 0 comment | 0 complexity | 063f776f7f78f4fe6db2cfbe84014e17 MD5 | raw file
 1using System.IO;
 2using Fijo.Net.Services.Socket.Streams;
 3using FijoCore.Infrastructure.LightContrib.Default.Service.Out.Interface;
 4using FijoCore.Infrastructure.LightContrib.Service.ExecptionFormatter;
 5using JetBrains.Annotations;
 6using SNet = System.Net.Sockets;
 7
 8namespace Fijo.Net.Services.Socket {
 9	[UsedImplicitly]
10	public class SocketService : ISocketService {
11		private readonly IOut _out;
12		private readonly IExceptionFormatter _exceptionFormatter;
13
14		public SocketService(IOut @out, IExceptionFormatter exceptionFormatter) {
15			_out = @out;
16			_exceptionFormatter = exceptionFormatter;
17		}
18
19		#region Implementation of ISocketService
20		public Stream GetStream(SNet.Socket socket) {
21			return new SocketStream(new SNet.NetworkStream(socket), _out, _exceptionFormatter);
22		}
23		#endregion
24	}
25}