Java.Net.URLConnection Class
A connection to a URL for reading or writing.

See Also: URLConnection Members


[Android.Runtime.Register("java/net/URLConnection", DoNotGenerateAcw=true)]
public abstract class URLConnection : Java.Lang.Object


A connection to a URL for reading or writing. For HTTP connections, see Java.Net.HttpURLConnection for documentation of HTTP-specific features.

For example, to retrieve

java Example

URL url = new URL("");
   URLConnection urlConnection = url.openConnection();
   InputStream in = new BufferedInputStream(urlConnection.getInputStream());
   try {
    finally {

URLConnection must be configured before it has connected to the remote resource. Instances of URLConnection are not reusable: you must use a different instance for each connection to a resource.


URLConnection supports two timeouts: a URLConnection.ConnectTimeout and a URLConnection.ReadTimeout. By default, operations never time out.

Built-in Protocols

Registering Additional Protocols

Use URL.SetURLStreamHandlerFactory(IURLStreamHandlerFactory) to register handlers for other protocol types.

[Android Documentation]


Namespace: Java.Net
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions:
Since: Added in API level 1