Project Name
XmobiTea.ProtonNetCommon
Installation Instructions
To install XmobiTea.ProtonNetCommon, follow these steps:
- Clone the repository:
git clone https://github.com/yourusername/XmobiTea.ProtonNetCommon.git
- Navigate into the project directory:
cd XmobiTea.ProtonNetCommon
- Restore the project dependencies:
dotnet restore
- Build the project:
dotnet build
Features
- Provides common utilities and helpers for networking in ProtonNet projects.
- Includes reusable components for handling HTTP requests and responses.
- Implements optimized memory management for network communication.
Usage Examples
Here are some examples of how to use XmobiTea.ProtonNetCommon:
Example 1: Creating an HTTP Response
response.SetContentType(".html");
response.SetBody("<html><body>Hello, World!</body></html>");
Console.WriteLine(response.BodyAsString);
Represents an HTTP response, encapsulating the protocol, status, headers, cookies,...
Definition HttpResponse.cs:14
Definition Constance.cs:2
StatusCode
This enum represents various HTTP status codes as defined by the HTTP/1.1 standard and related extens...
Definition StatusCode.cs:8
Definition ArrayExtensions.cs:4
Example 2: Using TcpServerOptions
{
AcceptorBacklog = 2048,
KeepAlive = true,
NoDelay = true
};
Console.WriteLine($"Backlog: {options.AcceptorBacklog}, KeepAlive: {options.KeepAlive}, NoDelay: {options.NoDelay}");
Represents the configuration options for the TCP server.
Definition TcpServerOptions.cs:7
Definition TcpServerOptions.cs:2
Supported Data Types
string
for text data, headers, and protocol.
byte[]
for raw data buffers and network communication.
Extensibility
- Extend
HttpResponse
to handle additional HTTP status codes or headers.
- Customize
TcpServerOptions
and UdpServerOptions
for specific network configurations.
- Implement additional helper methods or utilities as needed.
Contributing Guidelines
- Fork the repository.
- Create a feature branch:
git checkout -b feature/new-feature
- Commit your changes: ‘git commit -am 'Add new feature’
Push to the branch:
git push origin feature/new-feature`
- Open a pull request.
License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
Acknowledgments
- Inspired by common networking patterns and open-source libraries.
- Thanks to the community for their contributions and feedback.