Show / Hide Table of Contents

Class MicroServer

Provides a minimalistic HTTP web server that can provide only a single file. Useful for testing download code.

Inheritance
Object
MicroServer
Namespace: NanoByte.Common.Net
Assembly: NanoByte.Common.dll
Syntax
public sealed class MicroServer : Object

Constructors

MicroServer(String, Stream)

Starts a HTTP web server that listens on a random port.

Declaration
public MicroServer(string resourceName, Stream fileContent)
Parameters
Type Name Description
String resourceName

The HTTP resource name under which to provide the content.

Stream fileContent

The content of the file to serve.

Properties

FileContent

The content of the file to be served under FileUri.

Declaration
public Stream FileContent { get; }
Property Value
Type Description
Stream

FileUri

The complete URL under which the server provides its file.

Declaration
public Uri FileUri { get; }
Property Value
Type Description
Uri

ServerUri

The URL under which the server root can be reached. Usually you should use FileUri instead.

Declaration
public Uri ServerUri { get; }
Property Value
Type Description
Uri

Slow

Wait for twenty seconds every time before finishing a response.

Declaration
public bool Slow { get; set; }
Property Value
Type Description
Boolean

Methods

Dispose()

Stops listening for incoming HTTP connections.

Declaration
public void Dispose()

Extension Methods

UpdateUtils.To<TIn, TOut>(TIn, Func<TIn, TOut>)
JsonStorage.SaveJson<T>(T, Stream)
JsonStorage.SaveJson<T>(T, String)
JsonStorage.ToJsonString<T>(T)
JsonStorage.ReparseAsJson<T>(Object)
JsonStorage.ReparseAsJson<T>(Object, T)
XmlStorage.SaveXml(Object, Stream, String)
XmlStorage.SaveXml<T>(T, String, String)
XmlStorage.ToXmlString(Object, String)
ConversionUtils.ConvertToString<TType>(TType)
In This Article
Back to top Copyright Bastian Eicher