Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wtrsltnk/system.net

Partial c++ implementation of .NET System.Net classes
https://github.com/wtrsltnk/system.net

cpp net system-net systemnet sytem winsock2

Last synced: about 13 hours ago
JSON representation

Partial c++ implementation of .NET System.Net classes

Awesome Lists containing this project

README

        

# system.net

Partial c++ implementation of .NET System.Net classes

## Example Hello World

```c++
#include
#include
#include

using namespace System::Net::Http;

int main(int argc, char* argv[])
{
HttpListener listener;

listener.Prefixes().push_back("http://localhost:8383/");

try
{
listener.Start();

auto context = listener.GetContext();

context->Response()->WriteResponse("

Hello world

");
context->Response()->Close();

delete context;

listener.Stop();
}
catch (HttpListenerException const *ex)
{
std::cout << "Exception in http listener: " << ex->Message() << "\n";
}

return 0;
}

```

## Example Redirect

```c++
#include
#include
#include

using namespace System::Net::Http;

int main(int argc, char* argv[])
{
HttpListener listener;

listener.Prefixes().push_back("http://localhost:8383/");

try
{
listener.Start();

auto context = listener.GetContext();

context->Response()->Redirect("https://github.com/wtrsltnk");

delete context;

listener.Stop();
}
catch (HttpListenerException const *ex)
{
std::cout << "Exception in http listener: " << ex->Message() << "\n";
}

return 0;
}

```