Skip to content

Commit

Permalink
20210115
Browse files Browse the repository at this point in the history
  • Loading branch information
ldcsaa committed Jan 15, 2021
1 parent ad0a70d commit 074e5ed
Show file tree
Hide file tree
Showing 2,994 changed files with 752,295 additions and 29 deletions.
26 changes: 13 additions & 13 deletions DotNet/README.md
@@ -1,8 +1,12 @@
# [HPSocket.Net](https://gitee.com/int2e/HPSocket.Net)
# [HPSocket.Net](https://github.com/int2e/HPSocket.Net)

## Overview
the C# SDK for [HP-Socket](https://github.com/ldcsaa/HP-Socket)

#### .Net Framework Supported
* `.Net Framework 2.0+`
* `.Net Core 2.0+`
* `.Net 5.0`

#### Platform supported
* `Windows 7+ x86/x64`
Expand Down Expand Up @@ -88,6 +92,7 @@ Basic component is the original component provided by HP-Socket. For related usa
+ `ISslServer<TRequestBodyType>`
+ `ISslClient<TRequestBodyType>`
+ `ISslAgent<TRequestBodyType>`
+ `AsyncQueue`

`HPSocket.Net` provides a TCP port forwarding component` ITcpPortForwarding`, 10 lines of code can complete TCP port forwarding.

Expand All @@ -103,6 +108,8 @@ Basic component is the original component provided by HP-Socket. For related usa
+ `IWebSocketAgent` WebSocket Client (Unlike other Agent components, the WebSocket Agent component does not support connecting to different WebSocket Servers, which means that all connections of the `IWebSocketAgent` component can only connect to the same server)


`AsyncQueue` from [qq:842352715](https://gitee.com/zhige777/HPSocket.Net)

## Instructions
1. For the use of most components, please refer to the project in the `demo` directory.
2. In addition to the `Pack` series model, the `Agent` series components provided by `HPSocket.Net` (including the `ITcpPortForwarding` component) support to setting `HTTP` or `Socks5` proxy, which can be set in the manner of`List<IProxy>`. Multiple proxies can be set at the same time, which will be used randomly, and can be mixed with `HTTP` and `Socks5` proxy at the same time. For the usage method, refer to the `demo` of each` Agent` component.
Expand Down Expand Up @@ -263,9 +270,10 @@ namespace TcpServerTestEchoAdapter.DataReceiveAdapter
/// Parsing the request body
/// <remarks>Subclasses must override this method</remarks>
/// </summary>
/// <param name="data"></param>
/// <param name="header">header</param>
/// <param name="data">body data</param>
/// <returns></returns>
protected override Packet ParseRequestBody(byte[] data)
protected override Packet ParseRequestBody(byte[] header, byte[] data)
{
// Deserialize data into object
// Here is the object of the Packet class
Expand Down Expand Up @@ -410,7 +418,7 @@ namespace TcpServerTestEchoAdapter.DataReceiveAdapter
public HeadTailDataReceiveAdapter()
: base( // For example, the data format is "#* 123456 *#", which starts with #* and ends with *#, and the middle 123456 part is the real data
start : Encoding.UTF8.GetBytes("#*"), // Section start identifier, starting with #* here, pay attention to encoding issues, and be consistent at both sides
end : Encoding.UTF8.GetBytes("*#") // Section end identifier, starting with *# here, pay attention to encoding issues, and be consistent at both sides
end : Encoding.UTF8.GetBytes("*#") // Section end identifier, ends with *# here, pay attention to encoding issues, and be consistent at both sides
)
{
}
Expand All @@ -428,12 +436,4 @@ namespace TcpServerTestEchoAdapter.DataReceiveAdapter
}
}
}
```


## Contribute

1. Fork this Repository
2. Create a new Feat_xxx branch
3. Submit code
4. Create a new Pull Request
```
28 changes: 14 additions & 14 deletions DotNet/README_zh.md
@@ -1,8 +1,12 @@
# [HPSocket.Net](https://gitee.com/int2e/HPSocket.Net)
# [HPSocket.Net](https://github.com/int2e/HPSocket.Net)

## 概览
the C# SDK for [HP-Socket](https://github.com/ldcsaa/HP-Socket)

#### .Net 框架支持
* `.Net Framework 2.0+`
* `.Net Core 2.0+`
* `.Net 5.0`

#### 平台支持
* `Windows 7+ x86/x64`
Expand Down Expand Up @@ -88,6 +92,7 @@ Nuget软件包中的`libhpsocket4c.dylib`编译自`HP-Socket`的`macOS分支`[HP
+ `ISslServer<TRequestBodyType>`
+ `ISslClient<TRequestBodyType>`
+ `ISslAgent<TRequestBodyType>`
+ `AsyncQueue`

`HPSocket.Net` 提供一个Tcp端口转发组件`ITcpPortForwarding`,10行代码即可完成TCP端口转发

Expand All @@ -103,6 +108,8 @@ Nuget软件包中的`libhpsocket4c.dylib`编译自`HP-Socket`的`macOS分支`[HP
+ `IWebSocketAgent` WebSocket 客户端 (与其他Agent组件不同,WebSocket的Agent组件不支持连接到不同的WebSocket Server,也就是说`IWebSocketAgent`组件所有的连接都只能连接到同一个服务器)


`AsyncQueue` 来自 [qq:842352715](https://gitee.com/zhige777/HPSocket.Net)


## 使用说明
1. 大部分组件使用方法请参考`demo`目录下的工程
Expand Down Expand Up @@ -170,7 +177,7 @@ using(IHttpEasyClient httpClient = new HttpEasyClient())

完整示例在`demo/TcpServer-TestEcho-Adapter`

该系列组件是`HPSocket.Net``数据接收适配器`扩展组件,用户通过`自定义数据接收适配器`处理TCP通信中可能出现的`粘包``半包`等情况。`数据接收适配器`组件看起来这与HP-Socket的`Pack`组件有些相似,但它更加灵活,适配也非常简单方便。
该系列组件是`HPSocket.Net``数据接收适配器`扩展组件,用户通过`自定义数据接收适配器`处理TCP通信中可能出现的应用层所谓的`“粘包”``“半包”`等情况。`数据接收适配器`组件看起来这与HP-Socket的`Pack`组件有些相似,但它更加灵活,适配也非常简单方便。


+ `ITcpServer<TRequestBodyType>`/`ITcpClient<TRequestBodyType>`/`ITcpAgent<TRequestBodyType>`
Expand Down Expand Up @@ -265,9 +272,10 @@ namespace TcpServerTestEchoAdapter.DataReceiveAdapter
/// 解析请求体
/// <remarks>子类必须覆盖此方法</remarks>
/// </summary>
/// <param name="data"></param>
/// <param name="header">包头</param>
/// <param name="data">包体</param>
/// <returns></returns>
protected override Packet ParseRequestBody(byte[] data)
protected override Packet ParseRequestBody(byte[] header, byte[] data)
{
// 将data反序列化为对象
// 这里是Packet类的对象
Expand Down Expand Up @@ -412,7 +420,7 @@ namespace TcpServerTestEchoAdapter.DataReceiveAdapter
public HeadTailDataReceiveAdapter()
: base( // 例如数据格式是"#*123456*#",其中以#*开头,以*#结尾,中间123456部分是真实数据
start : Encoding.UTF8.GetBytes("#*"), // 区间起始标志,这里以#*开始,注意编码问题,要两端保持一致
end : Encoding.UTF8.GetBytes("*#") // 区间结束标志,这里以*#开始,注意编码问题,要两端保持一致
end : Encoding.UTF8.GetBytes("*#") // 区间结束标志,这里以*#结束,注意编码问题,要两端保持一致
)
{
}
Expand All @@ -430,12 +438,4 @@ namespace TcpServerTestEchoAdapter.DataReceiveAdapter
}
}
}
```


## 参与贡献

1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
```

0 comments on commit 074e5ed

Please sign in to comment.