NanoByte.Common  2.7.0
NanoByte.Common.Net.MicroServer Class Reference

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

Inheritance diagram for NanoByte.Common.Net.MicroServer:

Public Member Functions

 MicroServer ([Localizable(false)] string resourceName, Stream fileContent)
 Starts a HTTP web server that listens on a random port. More...
 
void Dispose ()
 Stops listening for incoming HTTP connections. More...
 

Properties

Uri ServerUri [get]
 The URL under which the server root can be reached. Usually you should use FileUri instead. More...
 
Uri FileUri [get]
 The complete URL under which the server provides its file. More...
 
Stream FileContent [get]
 The content of the file to be served under FileUri. More...
 
bool Slow [get, set]
 Wait for twenty seconds every time before finishing a response. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ MicroServer()

NanoByte.Common.Net.MicroServer.MicroServer ( [Localizable(false)] string  resourceName,
Stream  fileContent 
)
inline

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

Parameters
resourceNameThe HTTP resource name under which to provide the content.
fileContentThe content of the file to serve.

Member Function Documentation

◆ Dispose()

void NanoByte.Common.Net.MicroServer.Dispose ( )

Stops listening for incoming HTTP connections.

Property Documentation

◆ FileContent

Stream NanoByte.Common.Net.MicroServer.FileContent
get

The content of the file to be served under FileUri.

◆ FileUri

Uri NanoByte.Common.Net.MicroServer.FileUri
get

The complete URL under which the server provides its file.

◆ ServerUri

Uri NanoByte.Common.Net.MicroServer.ServerUri
get

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

◆ Slow

bool NanoByte.Common.Net.MicroServer.Slow
getset

Wait for twenty seconds every time before finishing a response.


The documentation for this class was generated from the following file: