-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnection.cs
More file actions
57 lines (47 loc) · 1.11 KB
/
Connection.cs
File metadata and controls
57 lines (47 loc) · 1.11 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
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
namespace NetAzy
{
public class Connection
{
private IPAddress ip;
private Socket socket;
private byte[] receiveBuffer;
public IncomingNetMessage HalfMessage;
public void Dispose()
{
socket.Close();
socket = null;
}
public bool Active
{
get { return socket.Connected; }
}
public int ReceiveBufferSize
{
get { return socket.ReceiveBufferSize; }
}
public byte[] ReceiveBuffer
{
get { return receiveBuffer; }
}
public Socket Socket
{
get { return socket; }
}
public IPAddress IP
{
get { return ip; }
}
public Connection(Socket socket)
{
this.socket = socket;
ip = ((IPEndPoint)socket.RemoteEndPoint).Address;
receiveBuffer = new byte[ReceiveBufferSize];
}
}
}