[System*] Throw a PlatformNotSupported exception when using the networking stack...
[mono.git] / mcs / class / System / System.Net.Sockets / TcpClient.platformnotsupported.cs
1 //
2 // System.Net.Sockets.TcpClient.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.Net;
31 using System.Threading.Tasks;
32
33 namespace System.Net.Sockets
34 {
35         public class TcpClient : IDisposable
36         {
37                 const string EXCEPTION_MESSAGE = "System.Net.Sockets.TcpClient is not supported on the current platform.";
38
39                 public TcpClient ()
40                 {
41                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
42                 }
43
44                 public TcpClient (AddressFamily family)
45                 {
46                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
47                 }
48
49                 public TcpClient (IPEndPoint localEP)
50                 {
51                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
52                 }
53
54                 public TcpClient (string hostname, int port)
55                 {
56                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
57                 }
58
59                 protected bool Active {
60                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
61                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
62                 }
63
64                 public Socket Client {
65                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
66                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
67                 }
68
69                 public int Available {
70                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
71                 }
72
73                 public bool Connected {
74                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
75                 }
76
77                 public bool ExclusiveAddressUse {
78                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
79                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
80                 }
81
82                 public LingerOption LingerState {
83                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
84                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
85                 }
86
87                 public bool NoDelay {
88                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
89                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
90                 }
91
92                 public int ReceiveBufferSize {
93                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
94                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
95                 }
96
97                 public int ReceiveTimeout {
98                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
99                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
100                 }
101
102                 public int SendBufferSize {
103                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
104                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
105                 }
106
107                 public int SendTimeout {
108                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
109                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
110                 }
111
112                 public void Close ()
113                 {
114                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
115                 }
116
117                 public void Connect (IPEndPoint remoteEP)
118                 {
119                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
120                 }
121
122                 public void Connect (IPAddress address, int port)
123                 {
124                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
125                 }
126
127                 public void Connect (string hostname, int port)
128                 {
129                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
130                 }
131
132                 public void Connect (IPAddress[] ipAddresses, int port)
133                 {
134                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
135                 }
136
137                 public void EndConnect (IAsyncResult asyncResult)
138                 {
139                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
140                 }
141
142                 public IAsyncResult BeginConnect (IPAddress address, int port, AsyncCallback requestCallback, object state)
143                 {
144                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
145                 }
146
147                 public IAsyncResult BeginConnect (IPAddress[] addresses, int port, AsyncCallback requestCallback, object state)
148                 {
149                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
150                 }
151
152                 public IAsyncResult BeginConnect (string host, int port, AsyncCallback requestCallback, object state)
153                 {
154                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
155                 }
156
157                 public void Dispose ()
158                 {
159                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
160                 }
161
162                 protected virtual void Dispose (bool disposing)
163                 {
164                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
165                 }
166
167                 ~TcpClient ()
168                 {
169                 }
170
171                 public NetworkStream GetStream()
172                 {
173                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
174                 }
175
176                 public Task ConnectAsync (IPAddress address, int port)
177                 {
178                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
179                 }
180
181                 public Task ConnectAsync (IPAddress[] addresses, int port)
182                 {
183                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
184                 }
185
186                 public Task ConnectAsync (string host, int port)
187                 {
188                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
189                 }
190         }
191 }