[System*] Throw a PlatformNotSupported exception when using the networking stack...
[mono.git] / mcs / class / System / System.Net.Sockets / UdpClient.platformnotsupported.cs
1 //
2 // System.Net.Sockets.UdpClient.cs
3 //
4 // Author:
5 //      Rolf Bjarne Kvinge <rolf@xamarin.com>
6 //
7 // Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using System;
30 using System.Threading.Tasks;
31
32 namespace System.Net.Sockets
33 {
34         public class UdpClient : IDisposable
35         {
36                 const string EXCEPTION_MESSAGE = "System.Net.Sockets.UdpClient is not supported on the current platform.";
37
38                 public UdpClient ()
39                 {
40                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
41                 }
42
43                 public UdpClient(AddressFamily family)
44                 {
45                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
46                 }
47
48                 public UdpClient (int port)
49                 {
50                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
51                 }
52
53                 public UdpClient (IPEndPoint localEP)
54                 {
55                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
56                 }
57
58                 public UdpClient (int port, AddressFamily family)
59                 {
60                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
61                 }
62
63                 public UdpClient (string hostname, int port)
64                 {
65                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
66                 }
67
68                 public void Close ()
69                 {
70                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
71                 }
72
73                 public void Connect (IPEndPoint endPoint)
74                 {
75                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
76                 }
77
78                 public void Connect (IPAddress addr, int port)
79                 {
80                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
81                 }
82
83                 public void Connect (string hostname, int port)
84                 {
85                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
86                 }
87
88                 public void DropMulticastGroup (IPAddress multicastAddr)
89                 {
90                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
91                 }
92
93                 public void DropMulticastGroup (IPAddress multicastAddr, int ifindex)
94                 {
95                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
96                 }
97
98                 public void JoinMulticastGroup (IPAddress multicastAddr)
99                 {
100                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
101                 }
102
103                 public void JoinMulticastGroup (int ifindex, IPAddress multicastAddr)
104                 {
105                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
106                 }
107
108                 public void JoinMulticastGroup (IPAddress multicastAddr, int timeToLive)
109                 {
110                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
111                 }
112
113                 public void JoinMulticastGroup (IPAddress multicastAddr, IPAddress localAddress)
114                 {
115                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
116                 }
117
118                 public byte [] Receive (ref IPEndPoint remoteEP)
119                 {
120                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
121                 }
122
123                 public int Send (byte [] dgram, int bytes)
124                 {
125                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
126                 }
127
128                 public int Send (byte [] dgram, int bytes, IPEndPoint endPoint)
129                 {
130                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
131                 }
132
133                 public int Send (byte [] dgram, int bytes, string hostname, int port)
134                 {
135                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
136                 }
137
138                 public IAsyncResult BeginSend (byte[] datagram, int bytes, AsyncCallback requestCallback, object state)
139                 {
140                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
141                 }
142
143                 public IAsyncResult BeginSend (byte[] datagram, int bytes, IPEndPoint endPoint, AsyncCallback requestCallback, object state)
144                 {
145                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
146                 }
147
148                 public IAsyncResult BeginSend (byte[] datagram, int bytes, string hostname, int port, AsyncCallback requestCallback, object state)
149                 {
150                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
151                 }
152
153                 public int EndSend (IAsyncResult asyncResult)
154                 {
155                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
156                 }
157
158                 public IAsyncResult BeginReceive (AsyncCallback requestCallback, object state)
159                 {
160                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
161                 }
162
163                 public byte[] EndReceive (IAsyncResult asyncResult, ref IPEndPoint remoteEP)
164                 {
165                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
166                 }
167
168                 protected bool Active {
169                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
170                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
171                 }
172
173                 public Socket Client {
174                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
175                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
176                 }
177
178                 public int Available {
179                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
180                 }
181
182                 public bool DontFragment {
183                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
184                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
185                 }
186
187                 public bool EnableBroadcast {
188                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
189                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
190                 }
191
192                 public bool ExclusiveAddressUse {
193                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
194                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
195                 }
196
197                 public bool MulticastLoopback {
198                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
199                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
200                 }
201
202                 public short Ttl {
203                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
204                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
205                 }
206
207                 public void Dispose ()
208                 {
209                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
210                 }
211
212                 protected virtual void Dispose (bool disposing)
213                 {
214                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
215                 }
216
217                 ~UdpClient ()
218                 {
219                 }
220
221                 public Task<UdpReceiveResult> ReceiveAsync ()
222                 {
223                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
224                 }
225
226                 public Task<int> SendAsync (byte[] datagram, int bytes)
227                 {
228                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
229                 }
230
231                 public Task<int> SendAsync (byte[] datagram, int bytes, IPEndPoint endPoint)
232                 {
233                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
234                 }
235
236                 public Task<int> SendAsync (byte[] datagram, int bytes, string hostname, int port)
237                 {
238                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
239                 }
240         }
241 }