forked from Code-Sharp/uHttpSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTcpClientAdapter.cs
More file actions
46 lines (36 loc) · 1.05 KB
/
Copy pathTcpClientAdapter.cs
File metadata and controls
46 lines (36 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace uhttpsharp.Clients
{
public class TcpClientAdapter : IClient
{
private readonly TcpClient _client;
private readonly NetworkStream _stream;
public TcpClientAdapter(TcpClient client)
{
_client = client;
_stream = _client.GetStream();
// The next lines are commented out because they caused exceptions, And i'm not sure why it has been added in the first place.
// See https://github.com/Code-Sharp/uHttpSharp/issues/14
// Read Timeout of one second.
// _stream.ReadTimeout = 1000;
}
public Stream Stream
{
get { return _stream; }
}
public bool Connected
{
get { return _client.Connected; }
}
public void Close()
{
_client.Close();
}
public EndPoint RemoteEndPoint
{
get { return _client.Client.RemoteEndPoint; }
}
}
}