QikNet.Ion
0.1.5
dotnet add package QikNet.Ion --version 0.1.5
NuGet\Install-Package QikNet.Ion -Version 0.1.5
<PackageReference Include="QikNet.Ion" Version="0.1.5" />
<PackageVersion Include="QikNet.Ion" Version="0.1.5" />
<PackageReference Include="QikNet.Ion" />
paket add QikNet.Ion --version 0.1.5
#r "nuget: QikNet.Ion, 0.1.5"
#:package QikNet.Ion@0.1.5
#addin nuget:?package=QikNet.Ion&version=0.1.5
#tool nuget:?package=QikNet.Ion&version=0.1.5
👋 Welcome to QikNet.Ion
This .NET library was created to simplify IO and networking operations. There are plans to expand this library to be more than IO and networking...
For the moment, the goal is to make IO and networking fun and easy to code. Right now you can write TCP/UDP clients and listeners - with HTTP/1.1 support.
Below are some examples of what the library can currently do...
Happy Coding!
PS: Try changing from TCP to UDP... 😉
📬️ Sending a HTTP request to example.com
This example shows how to create a TCP client to send and receive data:
using QikNet.Ion;
// 1) connect to domain on port 80 (HTTP)
var domain = "example.com";
using var client = TCP.Connect(domain, 80);
// 2) send a HTTP request through the client
client.Write(new HTTP1.Request {});
client.Write(new HTTP1.Headers {
["Host"] = domain,
["User-Agent"] = "ion/0.1.5",
["Accept"] = "*/*",
});
// 3) wait and receive HTTP response from client
while (client.Readable < 1) Thread.Yield();
client.Read(out HTTP1.Response response);
Console.WriteLine($"<< HTTP/1.1 {response.StatusCode} {response.ReasonPhrase}");
📬️ Receiving a HTTP request from anywhere...
This example shows how to create a TCP listener to receive and send data:
using QikNet.Ion;
// 1) create a TCP listener on port 12345
using var server = TCP.Listen(12345);
Console.WriteLine($":: listening on 'http://localhost:12345'");
var html = System.Text.Encoding.UTF8.GetBytes("<!DOCTYPE html><html><body>Hello World!</body></html>\n");
while (true)
{
// 3) accept a new client request to connect
server.Accept((endpoint, client) => {
// 4) wait and receive HTTP request from client
while (client.Readable < 1) Thread.Yield();
client.Read(out HTTP1.Request request);
switch ($"{request.Method} {request.RequestTarget}")
{
// 5.1) send a HTTP response to the client (200 OK)
case "GET /":
client.Write(new HTTP1.Response {});
client.Write(new HTTP1.Headers {
["Server"] = "ion/0.1.5",
["Connection"] = "close",
["Content-Type"] = "text/html;charset=utf-8",
["Content-Length"] = $"{html.Length}",
});
var offset = 0;
while ((offset += client.Write(html.AsSpan(offset))) < html.Length)
Thread.Yield();
break;
// 5.2) send a HTTP response to the client (404 Not Found)
default:
Console.WriteLine($"<< {request.Method} {request.RequestTarget} - 404 Not Found");
client.Write(new HTTP1.Response { StatusCode = 404 });
client.Write(new HTTP1.Headers {
["Server"] = "ion/0.1.5",
["Connection"] = "close",
});
break;
}
client.Close();
});
Thread.Sleep(1);
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Microsoft.Bcl.Memory (>= 10.0.8)
- Microsoft.CSharp (>= 4.7.0)
- System.Buffers (>= 4.6.1)
- System.Memory (>= 4.6.3)
-
.NETStandard 2.0
- Microsoft.Bcl.Memory (>= 10.0.8)
- Microsoft.CSharp (>= 4.7.0)
- System.Buffers (>= 4.6.1)
- System.Memory (>= 4.6.3)
-
net10.0
- Microsoft.Bcl.Memory (>= 10.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.