fix: 当传递消息过大时的,websocket 接收消息的不足

This commit is contained in:
ZhaoLei 2024-11-01 16:20:34 +08:00
parent 617f75ba36
commit 2ffe3c4373
4 changed files with 8 additions and 7 deletions

View file

@ -103,8 +103,8 @@ public class WebSocPipeLine<TSocket>(TSocket socket, bool isAES) : AbsPipeLine(i
protected override async Task Listen(Func<byte[], bool> receiveCb) protected override async Task Listen(Func<byte[], bool> receiveCb)
{ {
//warning 最大支持1MB这由需要同步的文件数量大小决定 UTF-8 每个字符汉字视为4个字节数字1个 英文字母2个。1MB=256KB*425万个字符能描述就行 //warning 最大支持10MB这由需要同步的文件数量大小决定 UTF-8 每个字符汉字视为4个字节数字1个 英文字母2个。1MB=256KB*425万个字符能描述就行
var buffer = new byte[1024 * 1024]; var buffer = new byte[10 * 1024 * 1024];
while (Socket.State == WebSocketState.Open) while (Socket.State == WebSocketState.Open)
{ {

View file

@ -41,7 +41,7 @@ if (app.Environment.IsDevelopment())
} }
app.UseWebSockets(); app.UseWebSockets();
//app.Urls.Clear(); app.Urls.Clear();
//app.Urls.Add("http://0.0.0.0:6819"); app.Urls.Add("http://0.0.0.0:6819");
app.MapControllers(); app.MapControllers();
app.Run(); app.Run();

View file

@ -11,7 +11,8 @@
"AllowedHosts": "*", "AllowedHosts": "*",
"TempDir": "D:\\FileSyncTest\\dtemp", "TempDir": "D:\\FileSyncTest\\dtemp",
"NamePwds": [ "NamePwds": [
[ "Test", "t123" ] [ "Test", "t123" ],
[ "FYMF", "FYMF" ]
], ],
"SqlPackageAbPath": "C:\\Users\\ZHAOLEI\\.dotnet\\tools\\sqlpackage.exe" "SqlPackageAbPath": "C:\\Users\\ZHAOLEI\\.dotnet\\tools\\sqlpackage.exe"
} }

View file

@ -6,8 +6,8 @@ class ConnectPipe {
// this.#websocket = new WebSocket(`ws://${window.location.host}`) // this.#websocket = new WebSocket(`ws://${window.location.host}`)
} }
OpenPipe(config, MsgCb) { OpenPipe(config, MsgCb) {
// var webSocUrl = `ws://${window.location.host}/websoc?Name=${config.Name}` var webSocUrl = `ws://${window.location.host}/websoc?Name=${config.Name}`
var webSocUrl = "ws://127.0.0.1:6818/websoc?Name=Test"; // var webSocUrl = "ws://127.0.0.1:6818/websoc?Name=Test";
this.#websocket = new WebSocket(webSocUrl); this.#websocket = new WebSocket(webSocUrl);
this.#websocket.onopen = (event) => { this.#websocket.onopen = (event) => {
var starter = { var starter = {