Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
若汝棋茗
RRQMSocket
提交
e75525e2
RRQMSocket
项目概览
若汝棋茗
/
RRQMSocket
大约 1 年 前同步成功
通知
20
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
RRQMSocket
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e75525e2
编写于
7月 29, 2022
作者:
若
若汝棋茗
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化UDP屏幕捕捉器
上级
901fc645
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
113 addition
and
38 deletion
+113
-38
TouchSocket.sln
TouchSocket.sln
+18
-1
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpReceiver/Form1.Designer.cs
...ples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpReceiver/Form1.Designer.cs
+0
-0
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpReceiver/Form1.cs
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpReceiver/Form1.cs
+5
-2
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpReceiver/Form1.resx
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpReceiver/Form1.resx
+0
-0
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpReceiver/Program.cs
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpReceiver/Program.cs
+0
-0
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpReceiver/ScreenUdpReceiver.csproj
...p简单示例/UDP屏幕捕捉器/ScreenUdpReceiver/ScreenUdpReceiver.csproj
+0
-0
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpSender/Form1.Designer.cs
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpSender/Form1.Designer.cs
+54
-8
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpSender/Form1.cs
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpSender/Form1.cs
+36
-23
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpSender/Form1.resx
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpSender/Form1.resx
+0
-4
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpSender/Program.cs
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpSender/Program.cs
+0
-0
examples/Udp简单示例/UDP屏幕捕捉器/ScreenUdpSender/ScreenUdpSender.csproj
...s/Udp简单示例/UDP屏幕捕捉器/ScreenUdpSender/ScreenUdpSender.csproj
+0
-0
未找到文件。
TouchSocket.sln
浏览文件 @
e75525e2
...
...
@@ -119,7 +119,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LimitNumberOfConnectionsCon
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThrottlingConsoleApp", "examples\BlogsDemos\ThrottlingConsoleApp\ThrottlingConsoleApp.csproj", "{DD7848E5-3489-454E-BF37-49B6FE4C7F01}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrafficCounterConsoleApp", "examples\BlogsDemos\TrafficCounterConsoleApp\TrafficCounterConsoleApp.csproj", "{82A783ED-11AD-407D-990B-A6AE9D557290}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TrafficCounterConsoleApp", "examples\BlogsDemos\TrafficCounterConsoleApp\TrafficCounterConsoleApp.csproj", "{82A783ED-11AD-407D-990B-A6AE9D557290}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UDP屏幕捕捉器", "UDP屏幕捕捉器", "{8B9374B5-42D7-48C9-84C7-A560167F0D47}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScreenUdpSender", "examples\Udp简单示例\UDP屏幕捕捉器\ScreenUdpSender\ScreenUdpSender.csproj", "{791D316B-41D7-4B19-A25B-A58EBEA4E04A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScreenUdpReceiver", "examples\Udp简单示例\UDP屏幕捕捉器\ScreenUdpReceiver\ScreenUdpReceiver.csproj", "{EDAA9CD3-1474-4588-9E3B-E970CED20F0F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
...
...
@@ -259,6 +265,14 @@ Global
{82A783ED-11AD-407D-990B-A6AE9D557290}.Debug|Any CPU.Build.0 = Debug|Any CPU
{82A783ED-11AD-407D-990B-A6AE9D557290}.Release|Any CPU.ActiveCfg = Release|Any CPU
{82A783ED-11AD-407D-990B-A6AE9D557290}.Release|Any CPU.Build.0 = Release|Any CPU
{791D316B-41D7-4B19-A25B-A58EBEA4E04A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{791D316B-41D7-4B19-A25B-A58EBEA4E04A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{791D316B-41D7-4B19-A25B-A58EBEA4E04A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{791D316B-41D7-4B19-A25B-A58EBEA4E04A}.Release|Any CPU.Build.0 = Release|Any CPU
{EDAA9CD3-1474-4588-9E3B-E970CED20F0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EDAA9CD3-1474-4588-9E3B-E970CED20F0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EDAA9CD3-1474-4588-9E3B-E970CED20F0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EDAA9CD3-1474-4588-9E3B-E970CED20F0F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
@@ -317,6 +331,9 @@ Global
{8452EA31-F7BB-4897-8881-F3EE3F82049A} = {EB38E883-88AF-4E4C-9DCD-FAEBD8A20968}
{DD7848E5-3489-454E-BF37-49B6FE4C7F01} = {EB38E883-88AF-4E4C-9DCD-FAEBD8A20968}
{82A783ED-11AD-407D-990B-A6AE9D557290} = {EB38E883-88AF-4E4C-9DCD-FAEBD8A20968}
{8B9374B5-42D7-48C9-84C7-A560167F0D47} = {F4D798A3-8D65-4750-9552-B02BCE081508}
{791D316B-41D7-4B19-A25B-A58EBEA4E04A} = {8B9374B5-42D7-48C9-84C7-A560167F0D47}
{EDAA9CD3-1474-4588-9E3B-E970CED20F0F} = {8B9374B5-42D7-48C9-84C7-A560167F0D47}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DB787235-A13A-4A3D-B5A8-5DFEB6511EEE}
...
...
examples/Udp简单示例/ScreenUdpReceiver/Form1.Designer.cs
→
examples/Udp简单示例/
UDP屏幕捕捉器/
ScreenUdpReceiver/Form1.Designer.cs
浏览文件 @
e75525e2
文件已移动
examples/Udp简单示例/ScreenUdpReceiver/Form1.cs
→
examples/Udp简单示例/
UDP屏幕捕捉器/
ScreenUdpReceiver/Form1.cs
浏览文件 @
e75525e2
...
...
@@ -6,6 +6,9 @@ using TouchSocket.Sockets;
namespace
ScreenUdpReceiver
{
/// <summary>
/// 本程序源码由网友“木南白水”提供。
/// </summary>
public
partial
class
Form1
:
Form
{
UdpSession
udpSession
;
...
...
@@ -26,8 +29,8 @@ namespace ScreenUdpReceiver
};
udpSession
.
Setup
(
new
TouchSocketConfig
()
.
SetBindIPHost
(
new
IPHost
(
"127.0.0.1:7790"
))
.
SetBufferLength
(
1024
*
102
4
)
.
SetUdpDataHandlingAdapter
(()
=>
{
return
new
UdpPackageAdapter
()
{
MaxPackageSize
=
1024
*
1024
};
})
.
SetBufferLength
(
1024
*
6
4
)
.
SetUdpDataHandlingAdapter
(()
=>
{
return
new
UdpPackageAdapter
()
{
MaxPackageSize
=
1024
*
1024
,
MTU
=
1024
*
10
};
})
).
Start
();
}
catch
(
Exception
ex
)
...
...
examples/Udp简单示例/ScreenUdpReceiver/Form1.resx
→
examples/Udp简单示例/
UDP屏幕捕捉器/
ScreenUdpReceiver/Form1.resx
浏览文件 @
e75525e2
文件已移动
examples/Udp简单示例/ScreenUdpReceiver/Program.cs
→
examples/Udp简单示例/
UDP屏幕捕捉器/
ScreenUdpReceiver/Program.cs
浏览文件 @
e75525e2
文件已移动
examples/Udp简单示例/ScreenUdpReceiver/ScreenUdpReceiver.csproj
→
examples/Udp简单示例/
UDP屏幕捕捉器/
ScreenUdpReceiver/ScreenUdpReceiver.csproj
浏览文件 @
e75525e2
文件已移动
examples/Udp简单示例/ScreenUdpSender/Form1.Designer.cs
→
examples/Udp简单示例/
UDP屏幕捕捉器/
ScreenUdpSender/Form1.Designer.cs
浏览文件 @
e75525e2
...
...
@@ -28,28 +28,74 @@
/// </summary>
private
void
InitializeComponent
()
{
this
.
components
=
new
System
.
ComponentModel
.
Container
();
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
numericUpDown1
=
new
System
.
Windows
.
Forms
.
NumericUpDown
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
numericUpDown1
)).
BeginInit
();
this
.
SuspendLayout
();
//
//
timer
1
//
button
1
//
this
.
timer1
.
Tick
+=
new
System
.
EventHandler
(
this
.
timer1_Tick
);
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
268
,
43
);
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
150
,
46
);
this
.
button1
.
TabIndex
=
0
;
this
.
button1
.
Text
=
"启动"
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
//
// numericUpDown1
//
this
.
numericUpDown1
.
Location
=
new
System
.
Drawing
.
Point
(
111
,
49
);
this
.
numericUpDown1
.
Maximum
=
new
decimal
(
new
int
[]
{
20
,
0
,
0
,
0
});
this
.
numericUpDown1
.
Minimum
=
new
decimal
(
new
int
[]
{
1
,
0
,
0
,
0
});
this
.
numericUpDown1
.
Name
=
"numericUpDown1"
;
this
.
numericUpDown1
.
Size
=
new
System
.
Drawing
.
Size
(
134
,
38
);
this
.
numericUpDown1
.
TabIndex
=
1
;
this
.
numericUpDown1
.
Value
=
new
decimal
(
new
int
[]
{
1
,
0
,
0
,
0
});
//
// label1
//
this
.
label1
.
AutoSize
=
true
;
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
33
,
51
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
62
,
31
);
this
.
label1
.
TabIndex
=
2
;
this
.
label1
.
Text
=
"FPS:"
;
//
// Form1
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
7F
,
17
F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
14F
,
31
F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
800
,
450
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1600
,
821
);
this
.
Controls
.
Add
(
this
.
label1
);
this
.
Controls
.
Add
(
this
.
numericUpDown1
);
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
6
,
5
,
6
,
5
);
this
.
Name
=
"Form1"
;
this
.
Text
=
"Sender 感谢若汝棋茗大佬的无私奉献 -xfdl 监听地址127.0.0.1:7789,发送地址127.0.0.1:7790"
;
this
.
Load
+=
new
System
.
EventHandler
(
this
.
Form1_Load
);
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
numericUpDown1
)).
EndInit
(
);
this
.
ResumeLayout
(
false
);
this
.
PerformLayout
();
}
#
endregion
private
System
.
Windows
.
Forms
.
Timer
timer1
;
private
System
.
Windows
.
Forms
.
Button
button1
;
private
System
.
Windows
.
Forms
.
NumericUpDown
numericUpDown1
;
private
System
.
Windows
.
Forms
.
Label
label1
;
}
}
examples/Udp简单示例/ScreenUdpSender/Form1.cs
→
examples/Udp简单示例/
UDP屏幕捕捉器/
ScreenUdpSender/Form1.cs
浏览文件 @
e75525e2
...
...
@@ -3,6 +3,7 @@ using System.Drawing;
using
System.IO
;
using
System.Net
;
using
System.Runtime.InteropServices
;
using
System.Threading
;
using
System.Windows.Forms
;
using
TouchSocket.Core.ByteManager
;
using
TouchSocket.Core.Config
;
...
...
@@ -10,6 +11,9 @@ using TouchSocket.Sockets;
namespace
ScreenUdpSender
{
/// <summary>
/// 本程序源码由网友“木南白水”提供。
/// </summary>
public
partial
class
Form1
:
Form
{
UdpSession
udpSession
;
...
...
@@ -18,34 +22,19 @@ namespace ScreenUdpSender
InitializeComponent
();
}
private
void
Form1_Load
(
object
sender
,
EventArgs
e
)
{
timer1
.
Enabled
=
true
;
try
{
udpSession
=
new
UdpSession
();
Thread
m_thread
;
udpSession
.
Setup
(
new
TouchSocketConfig
()
.
SetBindIPHost
(
new
IPHost
(
7789
))
.
SetBufferLength
(
1024
*
1024
)
.
SetUdpDataHandlingAdapter
(()
=>
{
return
new
UdpPackageAdapter
()
{
MaxPackageSize
=
1024
*
1024
};
})
).
Start
();
}
catch
(
Exception
ex
)
private
void
Tick
()
{
while
(
true
)
{
MessageBox
.
Show
(
$"错误:
{
ex
.
Message
}
,程序将退出"
);
Environment
.
Exit
(
0
);
byte
[]
byteArray
=
ImageToByte
(
getScreen
());
ByteBlock
bb
=
new
ByteBlock
(
byteArray
);
udpSession
.
Send
(
new
IPEndPoint
(
IPAddress
.
Parse
(
"127.0.0.1"
),
7790
),
bb
);
Thread
.
Sleep
((
int
)(
1000.0
/(
int
)
this
.
numericUpDown1
.
Value
));
}
}
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
{
byte
[]
byteArray
=
ImageToByte
(
getScreen
());
ByteBlock
bb
=
new
ByteBlock
(
byteArray
);
udpSession
.
Send
(
new
IPEndPoint
(
IPAddress
.
Parse
(
"127.0.0.1"
),
7790
),
bb
);
}
#
region
屏幕和光标获取
[
DllImport
(
"user32.dll"
)]
...
...
@@ -119,5 +108,29 @@ namespace ScreenUdpSender
return
image
;
}
#
endregion
private
void
button1_Click
(
object
sender
,
EventArgs
e
)
{
this
.
button1
.
Enabled
=
false
;
try
{
udpSession
=
new
UdpSession
();
udpSession
.
Setup
(
new
TouchSocketConfig
()
.
SetBindIPHost
(
new
IPHost
(
7789
))
.
SetBufferLength
(
1024
*
64
)
.
SetUdpDataHandlingAdapter
(()
=>
{
return
new
UdpPackageAdapter
()
{
MaxPackageSize
=
1024
*
1024
,
MTU
=
1024
*
10
};
})
).
Start
();
m_thread
=
new
Thread
(
Tick
);
m_thread
.
IsBackground
=
true
;
m_thread
.
Start
();
}
catch
(
Exception
ex
)
{
MessageBox
.
Show
(
$"错误:
{
ex
.
Message
}
,程序将退出"
);
Environment
.
Exit
(
0
);
}
}
}
}
examples/Udp简单示例/ScreenUdpSender/Form1.resx
→
examples/Udp简单示例/
UDP屏幕捕捉器/
ScreenUdpSender/Form1.resx
浏览文件 @
e75525e2
...
...
@@ -57,7 +57,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
examples/Udp简单示例/ScreenUdpSender/Program.cs
→
examples/Udp简单示例/
UDP屏幕捕捉器/
ScreenUdpSender/Program.cs
浏览文件 @
e75525e2
文件已移动
examples/Udp简单示例/ScreenUdpSender/ScreenUdpSender.csproj
→
examples/Udp简单示例/
UDP屏幕捕捉器/
ScreenUdpSender/ScreenUdpSender.csproj
浏览文件 @
e75525e2
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录