Skip to content

Commit b1920d9

Browse files
committed
Refactoring design version v2019.1.0.0-preview1
1 parent 885f4b9 commit b1920d9

113 files changed

Lines changed: 2150 additions & 7879 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

GodSharp.Socket.sln

Lines changed: 19 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1313
README.md = README.md
1414
EndProjectSection
1515
EndProject
16-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{56DB72CA-6C54-4BEC-956C-60CAE3828741}"
17-
EndProject
18-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{169FDBD0-1C98-4A7E-B8B6-1023B73624F0}"
19-
EndProject
20-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Chat", "Chat", "{43852E3B-E5B7-4A54-B450-4B48F6C3F025}"
21-
EndProject
2216
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{3E90692F-1C39-4244-88E3-EEA2B02FE7E7}"
2317
ProjectSection(SolutionItems) = preProject
2418
build\version.props = build\version.props
2519
EndProjectSection
2620
EndProject
2721
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GodSharp.Socket", "src\GodSharp.Socket\GodSharp.Socket.csproj", "{06BBFBF4-9958-42CB-9920-3CF516773368}"
2822
EndProject
29-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tcp", "Tcp", "{24B5B2E3-EA6E-4293-A193-9834EDA39449}"
30-
EndProject
31-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Udp", "Udp", "{E2DF802B-2A61-4B35-8407-6EA9EEA25FEC}"
32-
EndProject
33-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{B6BB1EDD-840E-4799-BA1D-2ECED21BC443}"
34-
EndProject
35-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GodSharp.SocketClientSapmle", "sample\Tcp\Samples\GodSharp.SocketClientSapmle\GodSharp.SocketClientSapmle.csproj", "{DA03E415-51BC-4223-B8C8-E2ABFF1F77AF}"
36-
EndProject
37-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GodSharp.SocketServerSample", "sample\Tcp\Samples\GodSharp.SocketServerSample\GodSharp.SocketServerSample.csproj", "{8F3CAA2A-6DC3-46D5-ABE6-3850F29FFF75}"
38-
EndProject
39-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GodSharp.Chat", "sample\Tcp\Chat\GodSharp.Chat\GodSharp.Chat.csproj", "{D556F994-9A72-4F30-8B55-9D9FAA14C5FE}"
40-
EndProject
41-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GodSharp.ChatClient", "sample\Tcp\Chat\GodSharp.ChatClient\GodSharp.ChatClient.csproj", "{B1EFC930-1A12-4FA6-9BDA-EC27E477528B}"
23+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{508DCAC4-EBCB-4C9B-B8FD-DFE51827ADFF}"
4224
EndProject
43-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GodSharp.ChatServer", "sample\Tcp\Chat\GodSharp.ChatServer\GodSharp.ChatServer.csproj", "{5DD72AA1-F791-446C-9939-0CB1C5483D04}"
25+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GodSharp.Socket.TcpClientSample", "samples\GodSharp.Socket.TcpClientSample\GodSharp.Socket.TcpClientSample.csproj", "{3F358017-1FF1-48AC-BA29-DF4E72E25A77}"
4426
EndProject
45-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GodSharp.UdpClientMasterSample", "sample\Udp\Samples\GodSharp.UdpClientMasterSample\GodSharp.UdpClientMasterSample.csproj", "{91D1F01F-2D76-4B3C-8871-E76BC69A873B}"
27+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GodSharp.Socket.TcpServerSample", "samples\GodSharp.Socket.TcpServerSample\GodSharp.Socket.TcpServerSample.csproj", "{3730B10A-FF1F-452F-AA6C-24CD83563BCF}"
4628
EndProject
47-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GodSharp.UdpClientSlaveSample", "sample\Udp\Samples\GodSharp.UdpClientSlaveSample\GodSharp.UdpClientSlaveSample.csproj", "{6FFB5059-7BF4-49B4-BBC0-1446A48E778D}"
29+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GodSharp.Socket.UdpClientSample", "samples\GodSharp.Socket.UdpClientSample\GodSharp.Socket.UdpClientSample.csproj", "{1138BDDF-3C2B-40A6-A76E-A93ECC046AF5}"
4830
EndProject
4931
Global
5032
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -56,52 +38,27 @@ Global
5638
{06BBFBF4-9958-42CB-9920-3CF516773368}.Debug|Any CPU.Build.0 = Debug|Any CPU
5739
{06BBFBF4-9958-42CB-9920-3CF516773368}.Release|Any CPU.ActiveCfg = Release|Any CPU
5840
{06BBFBF4-9958-42CB-9920-3CF516773368}.Release|Any CPU.Build.0 = Release|Any CPU
59-
{DA03E415-51BC-4223-B8C8-E2ABFF1F77AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
60-
{DA03E415-51BC-4223-B8C8-E2ABFF1F77AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
61-
{DA03E415-51BC-4223-B8C8-E2ABFF1F77AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
62-
{DA03E415-51BC-4223-B8C8-E2ABFF1F77AF}.Release|Any CPU.Build.0 = Release|Any CPU
63-
{8F3CAA2A-6DC3-46D5-ABE6-3850F29FFF75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
64-
{8F3CAA2A-6DC3-46D5-ABE6-3850F29FFF75}.Debug|Any CPU.Build.0 = Debug|Any CPU
65-
{8F3CAA2A-6DC3-46D5-ABE6-3850F29FFF75}.Release|Any CPU.ActiveCfg = Release|Any CPU
66-
{8F3CAA2A-6DC3-46D5-ABE6-3850F29FFF75}.Release|Any CPU.Build.0 = Release|Any CPU
67-
{D556F994-9A72-4F30-8B55-9D9FAA14C5FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
68-
{D556F994-9A72-4F30-8B55-9D9FAA14C5FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
69-
{D556F994-9A72-4F30-8B55-9D9FAA14C5FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
70-
{D556F994-9A72-4F30-8B55-9D9FAA14C5FE}.Release|Any CPU.Build.0 = Release|Any CPU
71-
{B1EFC930-1A12-4FA6-9BDA-EC27E477528B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
72-
{B1EFC930-1A12-4FA6-9BDA-EC27E477528B}.Debug|Any CPU.Build.0 = Debug|Any CPU
73-
{B1EFC930-1A12-4FA6-9BDA-EC27E477528B}.Release|Any CPU.ActiveCfg = Release|Any CPU
74-
{B1EFC930-1A12-4FA6-9BDA-EC27E477528B}.Release|Any CPU.Build.0 = Release|Any CPU
75-
{5DD72AA1-F791-446C-9939-0CB1C5483D04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
76-
{5DD72AA1-F791-446C-9939-0CB1C5483D04}.Debug|Any CPU.Build.0 = Debug|Any CPU
77-
{5DD72AA1-F791-446C-9939-0CB1C5483D04}.Release|Any CPU.ActiveCfg = Release|Any CPU
78-
{5DD72AA1-F791-446C-9939-0CB1C5483D04}.Release|Any CPU.Build.0 = Release|Any CPU
79-
{91D1F01F-2D76-4B3C-8871-E76BC69A873B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
80-
{91D1F01F-2D76-4B3C-8871-E76BC69A873B}.Debug|Any CPU.Build.0 = Debug|Any CPU
81-
{91D1F01F-2D76-4B3C-8871-E76BC69A873B}.Release|Any CPU.ActiveCfg = Release|Any CPU
82-
{91D1F01F-2D76-4B3C-8871-E76BC69A873B}.Release|Any CPU.Build.0 = Release|Any CPU
83-
{6FFB5059-7BF4-49B4-BBC0-1446A48E778D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
84-
{6FFB5059-7BF4-49B4-BBC0-1446A48E778D}.Debug|Any CPU.Build.0 = Debug|Any CPU
85-
{6FFB5059-7BF4-49B4-BBC0-1446A48E778D}.Release|Any CPU.ActiveCfg = Release|Any CPU
86-
{6FFB5059-7BF4-49B4-BBC0-1446A48E778D}.Release|Any CPU.Build.0 = Release|Any CPU
41+
{3F358017-1FF1-48AC-BA29-DF4E72E25A77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42+
{3F358017-1FF1-48AC-BA29-DF4E72E25A77}.Debug|Any CPU.Build.0 = Debug|Any CPU
43+
{3F358017-1FF1-48AC-BA29-DF4E72E25A77}.Release|Any CPU.ActiveCfg = Release|Any CPU
44+
{3F358017-1FF1-48AC-BA29-DF4E72E25A77}.Release|Any CPU.Build.0 = Release|Any CPU
45+
{3730B10A-FF1F-452F-AA6C-24CD83563BCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46+
{3730B10A-FF1F-452F-AA6C-24CD83563BCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
47+
{3730B10A-FF1F-452F-AA6C-24CD83563BCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
48+
{3730B10A-FF1F-452F-AA6C-24CD83563BCF}.Release|Any CPU.Build.0 = Release|Any CPU
49+
{1138BDDF-3C2B-40A6-A76E-A93ECC046AF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50+
{1138BDDF-3C2B-40A6-A76E-A93ECC046AF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
51+
{1138BDDF-3C2B-40A6-A76E-A93ECC046AF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
52+
{1138BDDF-3C2B-40A6-A76E-A93ECC046AF5}.Release|Any CPU.Build.0 = Release|Any CPU
8753
EndGlobalSection
8854
GlobalSection(SolutionProperties) = preSolution
8955
HideSolutionNode = FALSE
9056
EndGlobalSection
9157
GlobalSection(NestedProjects) = preSolution
92-
{169FDBD0-1C98-4A7E-B8B6-1023B73624F0} = {24B5B2E3-EA6E-4293-A193-9834EDA39449}
93-
{43852E3B-E5B7-4A54-B450-4B48F6C3F025} = {24B5B2E3-EA6E-4293-A193-9834EDA39449}
9458
{06BBFBF4-9958-42CB-9920-3CF516773368} = {2D285DE6-8FC0-4FB6-A438-EA2AD5FEA561}
95-
{24B5B2E3-EA6E-4293-A193-9834EDA39449} = {56DB72CA-6C54-4BEC-956C-60CAE3828741}
96-
{E2DF802B-2A61-4B35-8407-6EA9EEA25FEC} = {56DB72CA-6C54-4BEC-956C-60CAE3828741}
97-
{B6BB1EDD-840E-4799-BA1D-2ECED21BC443} = {E2DF802B-2A61-4B35-8407-6EA9EEA25FEC}
98-
{DA03E415-51BC-4223-B8C8-E2ABFF1F77AF} = {169FDBD0-1C98-4A7E-B8B6-1023B73624F0}
99-
{8F3CAA2A-6DC3-46D5-ABE6-3850F29FFF75} = {169FDBD0-1C98-4A7E-B8B6-1023B73624F0}
100-
{D556F994-9A72-4F30-8B55-9D9FAA14C5FE} = {43852E3B-E5B7-4A54-B450-4B48F6C3F025}
101-
{B1EFC930-1A12-4FA6-9BDA-EC27E477528B} = {43852E3B-E5B7-4A54-B450-4B48F6C3F025}
102-
{5DD72AA1-F791-446C-9939-0CB1C5483D04} = {43852E3B-E5B7-4A54-B450-4B48F6C3F025}
103-
{91D1F01F-2D76-4B3C-8871-E76BC69A873B} = {B6BB1EDD-840E-4799-BA1D-2ECED21BC443}
104-
{6FFB5059-7BF4-49B4-BBC0-1446A48E778D} = {B6BB1EDD-840E-4799-BA1D-2ECED21BC443}
59+
{3F358017-1FF1-48AC-BA29-DF4E72E25A77} = {508DCAC4-EBCB-4C9B-B8FD-DFE51827ADFF}
60+
{3730B10A-FF1F-452F-AA6C-24CD83563BCF} = {508DCAC4-EBCB-4C9B-B8FD-DFE51827ADFF}
61+
{1138BDDF-3C2B-40A6-A76E-A93ECC046AF5} = {508DCAC4-EBCB-4C9B-B8FD-DFE51827ADFF}
10562
EndGlobalSection
10663
GlobalSection(ExtensibilityGlobals) = postSolution
10764
SolutionGuid = {68DFC265-6267-4153-8375-A35F8E5CD820}

README.md

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -16,74 +16,7 @@ A easy to use socket server and client for .NET.
1616

1717
# Getting Started
1818

19-
1. Server
20-
21-
```
22-
static void Main()
23-
{
24-
Random random = new Random();
25-
SocketServer server = new SocketServer(port:7788)
26-
{
27-
OnConnected = (sender) =>
28-
{
29-
Console.WriteLine($"Client {sender.RemoteEndPoint.ToString()} connected");
30-
}
31-
};
32-
33-
server.OnData = (sender, data) =>
34-
{
35-
//get client data
36-
string message = server.Encoding.GetString(data, 0, data.Length);
37-
Console.WriteLine($"server received data from {sender.RemoteEndPoint}: {message}");
38-
39-
//message = "server repley " + message;
40-
message = random.Next(100000000, 999999999).ToString();
41-
sender.Send(message);
42-
43-
Console.WriteLine($"server send data to {sender.RemoteEndPoint}: {message}");
44-
};
45-
46-
server.Listen();
47-
server.Start();
48-
49-
Console.ReadKey();
50-
}
51-
```
52-
53-
2. Client
54-
55-
```
56-
static void Main()
57-
{
58-
Console.ReadKey();
59-
60-
SocketClient client = new SocketClient("127.0.0.1", 7788);
61-
62-
client.OnData = (sender, data) =>
63-
{
64-
//get server data
65-
string message = client.Encoding.GetString(data, 0, data.Length);
66-
Console.WriteLine($"client received data from {sender.RemoteEndPoint.ToString()}: {message}");
67-
};
68-
69-
client.Connect();
70-
71-
client.Start();
72-
73-
string msg = Console.ReadLine();
74-
75-
while (msg.ToLower() != "q")
76-
{
77-
client.Sender.Send(msg);
78-
Console.WriteLine($"client send data to {client.RemoteEndPoint.ToString()}: {msg}");
79-
msg = Console.ReadLine();
80-
}
81-
}
82-
```
83-
84-
# Todo
85-
support async
86-
19+
See [samples](./src/samples).
8720

8821
[0]: https://github.com/godsharp/GodSharp.Socket
8922
[si]: https://img.shields.io/github/languages/code-size/godsharp/GodSharp.Socket.svg?style=flat-square

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 1.0.1.{build}
1+
version: 2019.1.0.{build}
22
branches:
33
only:
44
- master

build/version.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project>
22
<PropertyGroup Condition="'$(AssemblyName)'=='GodSharp.Socket'">
33
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
4-
<Version>1.0.2-preview6</Version>
4+
<Version>2019.1.0.0-preview1</Version>
5+
<FileVersion>2019.1.0.0-preview1</FileVersion>
56
</PropertyGroup>
67
</Project>

sample/Tcp/Chat/GodSharp.Chat/Enum/MessageType.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

sample/Tcp/Chat/GodSharp.Chat/Enum/SocketType.cs

Lines changed: 0 additions & 8 deletions
This file was deleted.

sample/Tcp/Chat/GodSharp.Chat/Extension/Extension.cs

Lines changed: 0 additions & 43 deletions
This file was deleted.

sample/Tcp/Chat/GodSharp.Chat/GodSharp.Chat.csproj

Lines changed: 0 additions & 100 deletions
This file was deleted.

sample/Tcp/Chat/GodSharp.Chat/Object/R.cs

Lines changed: 0 additions & 8 deletions
This file was deleted.

sample/Tcp/Chat/GodSharp.Chat/Object/ServerParameter.cs

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)