-
Notifications
You must be signed in to change notification settings - Fork 0
/
UDPClientException.cs
53 lines (47 loc) · 1.5 KB
/
UDPClientException.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UDPTracker
{
public enum UDPClientError
{
BadPort, BadServer, RequestTimeout, ResponseTimeout, ConnectionClosed, SocketError, Unknown,
BadInfoHash, BadPeerID, BadTransactionID, BadRequest, BadResponse
}
public class UDPClientException : Exception
{
private UDPClientError m_error;
private string m_server;
private short m_port;
#region Constructors
public UDPClientException(string message, UDPClientError error)
: base(message)
{
m_error = error;
m_server = string.Empty;
m_port = 0;
}
public UDPClientException(string message, Exception innerException, UDPClientError error)
: base(message, innerException)
{
m_error = error;
m_server = string.Empty;
m_port = 0;
}
public UDPClientException(string message, Exception innerException, UDPClientError error, string server, short port)
: base(message, innerException)
{
m_error = error;
m_server = server;
m_port = port;
}
#endregion
#region Properties
public UDPClientError Error { get { return m_error; } }
public string Server { get { return m_server; } }
public short Port { get { return m_port; } }
#endregion
}
}