UdpClient.platformnotsupported.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. //
  2. // System.Net.Sockets.UdpClient.cs
  3. //
  4. // Author:
  5. // Rolf Bjarne Kvinge <[email protected]>
  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. using System;
  29. using System.Threading.Tasks;
  30. namespace System.Net.Sockets
  31. {
  32. public class UdpClient : IDisposable
  33. {
  34. const string EXCEPTION_MESSAGE = "System.Net.Sockets.UdpClient is not supported on the current platform.";
  35. public UdpClient ()
  36. {
  37. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  38. }
  39. public UdpClient(AddressFamily family)
  40. {
  41. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  42. }
  43. public UdpClient (int port)
  44. {
  45. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  46. }
  47. public UdpClient (IPEndPoint localEP)
  48. {
  49. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  50. }
  51. public UdpClient (int port, AddressFamily family)
  52. {
  53. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  54. }
  55. public UdpClient (string hostname, int port)
  56. {
  57. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  58. }
  59. public void Close ()
  60. {
  61. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  62. }
  63. public void Connect (IPEndPoint endPoint)
  64. {
  65. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  66. }
  67. public void Connect (IPAddress addr, int port)
  68. {
  69. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  70. }
  71. public void Connect (string hostname, int port)
  72. {
  73. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  74. }
  75. public void DropMulticastGroup (IPAddress multicastAddr)
  76. {
  77. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  78. }
  79. public void DropMulticastGroup (IPAddress multicastAddr, int ifindex)
  80. {
  81. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  82. }
  83. public void JoinMulticastGroup (IPAddress multicastAddr)
  84. {
  85. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  86. }
  87. public void JoinMulticastGroup (int ifindex, IPAddress multicastAddr)
  88. {
  89. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  90. }
  91. public void JoinMulticastGroup (IPAddress multicastAddr, int timeToLive)
  92. {
  93. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  94. }
  95. public void JoinMulticastGroup (IPAddress multicastAddr, IPAddress localAddress)
  96. {
  97. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  98. }
  99. public byte [] Receive (ref IPEndPoint remoteEP)
  100. {
  101. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  102. }
  103. public int Send (byte [] dgram, int bytes)
  104. {
  105. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  106. }
  107. public int Send (byte [] dgram, int bytes, IPEndPoint endPoint)
  108. {
  109. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  110. }
  111. public int Send (byte [] dgram, int bytes, string hostname, int port)
  112. {
  113. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  114. }
  115. public IAsyncResult BeginSend (byte[] datagram, int bytes, AsyncCallback requestCallback, object state)
  116. {
  117. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  118. }
  119. public IAsyncResult BeginSend (byte[] datagram, int bytes, IPEndPoint endPoint, AsyncCallback requestCallback, object state)
  120. {
  121. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  122. }
  123. public IAsyncResult BeginSend (byte[] datagram, int bytes, string hostname, int port, AsyncCallback requestCallback, object state)
  124. {
  125. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  126. }
  127. public int EndSend (IAsyncResult asyncResult)
  128. {
  129. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  130. }
  131. public IAsyncResult BeginReceive (AsyncCallback requestCallback, object state)
  132. {
  133. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  134. }
  135. public byte[] EndReceive (IAsyncResult asyncResult, ref IPEndPoint remoteEP)
  136. {
  137. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  138. }
  139. protected bool Active {
  140. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  141. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  142. }
  143. public Socket Client {
  144. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  145. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  146. }
  147. public int Available {
  148. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  149. }
  150. public bool DontFragment {
  151. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  152. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  153. }
  154. public bool EnableBroadcast {
  155. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  156. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  157. }
  158. public bool ExclusiveAddressUse {
  159. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  160. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  161. }
  162. public bool MulticastLoopback {
  163. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  164. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  165. }
  166. public short Ttl {
  167. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  168. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  169. }
  170. public void AllowNatTraversal (bool allowed)
  171. {
  172. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  173. }
  174. public void Dispose ()
  175. {
  176. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  177. }
  178. protected virtual void Dispose (bool disposing)
  179. {
  180. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  181. }
  182. ~UdpClient ()
  183. {
  184. }
  185. public Task<UdpReceiveResult> ReceiveAsync ()
  186. {
  187. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  188. }
  189. public Task<int> SendAsync (byte[] datagram, int bytes)
  190. {
  191. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  192. }
  193. public Task<int> SendAsync (byte[] datagram, int bytes, IPEndPoint endPoint)
  194. {
  195. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  196. }
  197. public Task<int> SendAsync (byte[] datagram, int bytes, string hostname, int port)
  198. {
  199. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  200. }
  201. }
  202. }