Skip to content

Commit

Permalink
modify logic of buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
hiram3512 committed Apr 4, 2019
1 parent 2f54f19 commit 9612edb
Show file tree
Hide file tree
Showing 48 changed files with 36 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/HiSocket.Example/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

<supportedRuntime version="v2.0.50727"/></startup>
</configuration>
3 changes: 2 additions & 1 deletion src/HiSocket.Example/HiSocket.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
<OutputType>Exe</OutputType>
<RootNamespace>HiSocket.Example</RootNamespace>
<AssemblyName>HiSocket.Example</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile>Unity Subset v3.5</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
Binary file modified src/HiSocket.Example/bin/Debug/HiSocket.Example.exe
Binary file not shown.
8 changes: 4 additions & 4 deletions src/HiSocket.Example/bin/Debug/HiSocket.Example.exe.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

<supportedRuntime version="v2.0.50727"/></startup>
</configuration>
Binary file modified src/HiSocket.Example/bin/Debug/HiSocket.Example.pdb
Binary file not shown.
Binary file modified src/HiSocket.Example/bin/Debug/HiSocket.Message.dll
Binary file not shown.
Binary file modified src/HiSocket.Example/bin/Debug/HiSocket.Message.pdb
Binary file not shown.
Binary file modified src/HiSocket.Example/bin/Debug/HiSocket.dll
Binary file not shown.
Binary file modified src/HiSocket.Example/bin/Debug/HiSocket.pdb
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f30679e8703ee0bde5a883148d1cfe583578e62f
bfe03b0b643ce2cb02f88d3aac3eb1d5b32f5a25
Binary file not shown.
Binary file modified src/HiSocket.Example/obj/Debug/HiSocket.Example.exe
Binary file not shown.
Binary file modified src/HiSocket.Example/obj/Debug/HiSocket.Example.pdb
Binary file not shown.
1 change: 1 addition & 0 deletions src/HiSocket.Message/HiSocket.Message.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<AssemblyName>HiSocket.Message</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Unity Subset v3.5</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a9d6d1160fc5262789cd2aa4fa606d957210502b
85163093e10efbb4350ab8970a86af5be6cb488c
Binary file not shown.
Binary file modified src/HiSocket.Message/obj/Debug/HiSocket.Message.dll
Binary file not shown.
Binary file modified src/HiSocket.Message/obj/Debug/HiSocket.Message.pdb
Binary file not shown.
3 changes: 2 additions & 1 deletion src/HiSocket.Test/HiSocket.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HiSocket.Test</RootNamespace>
<AssemblyName>HiSocket.Test</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
Expand All @@ -19,6 +19,7 @@
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.Message.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.Message.pdb
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.Test.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.Test.pdb
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.pdb
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cce52a4795e6d5db3dbd01a2cfaca65891eb473c
d2c55b9ca13d0ef5d02990a6d4e0e07c8e133469
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ D:\MyGit\github\HiSocket\src\HiSocket.Test\obj\Debug\HiSocket.Test.csproj.CoreCo
D:\MyGit\github\HiSocket\src\HiSocket.Test\obj\Debug\HiSocket.Test.csproj.CopyComplete
D:\MyGit\github\HiSocket\src\HiSocket.Test\obj\Debug\HiSocket.Test.dll
D:\MyGit\github\HiSocket\src\HiSocket.Test\obj\Debug\HiSocket.Test.pdb
D:\MyGit\github\HiSocket\src\HiSocket.Test\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll
D:\MyGit\github\HiSocket\src\HiSocket.Test\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll
D:\MyGit\github\HiSocket\src\HiSocket.Test\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll
D:\MyGit\github\HiSocket\src\HiSocket.Test\bin\Debug\zh-Hans\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll
D:\MyGit\github\HiSocket\src\HiSocket.Test\bin\Debug\zh-Hans\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll
D:\MyGit\github\HiSocket\src\HiSocket.Test\bin\Debug\zh-Hans\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/obj/Debug/HiSocket.Test.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/obj/Debug/HiSocket.Test.pdb
Binary file not shown.
1 change: 1 addition & 0 deletions src/HiSocket/HiSocket.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<AssemblyName>HiSocket</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Unity Subset v3.5</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
13 changes: 12 additions & 1 deletion src/HiSocket/TcpConnection/Socket/TcpSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,18 @@ private void EndSend(IAsyncResult ar)

private void Receive()
{
var count = ReceiveBuffer.HowManyCanWrite;
//var count = ReceiveBuffer.HowManyCanWrite;//可写下标不连续
var count = 0;
if (ReceiveBuffer.EState == CircularBuffer<byte>.State.WriteAhead)
count = ReceiveBuffer.Size - ReceiveBuffer.WritePosition;
else if (ReceiveBuffer.EState == CircularBuffer<byte>.State.ReadAhead)
count = ReceiveBuffer.ReadPosition - ReceiveBuffer.WritePosition;
else if (ReceiveBuffer.EState == CircularBuffer<byte>.State.WriteEqualRead)
count = ReceiveBuffer.Size - ReceiveBuffer.WritePosition;
else
{
throw new Exception("state error");
}
try
{
Socket.BeginReceive(ReceiveBuffer.Array, ReceiveBuffer.WritePosition, count, SocketFlags.None,
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aef6f356fafc0e0347fe76958283966412dbbff8
e8480a323b2418b5cc5ee873db9a6c748952099e
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ D:\MyGit\github\HiSocket\visual\HiSocket\obj\Debug\HiSocket.dll
D:\MyGit\github\HiSocket\visual\HiSocket\obj\Debug\HiSocket.pdb
D:\MyGit\github\HiSocket\src\release\HiSocket.dll
D:\MyGit\github\HiSocket\src\release\HiSocket.pdb
D:\MyGit\github\HiSocket\src\HiSocket\obj\Debug\HiSocket.csprojAssemblyReference.cache
D:\MyGit\github\HiSocket\src\HiSocket\obj\Debug\HiSocket.csproj.CoreCompileInputs.cache
D:\MyGit\github\HiSocket\src\HiSocket\obj\Debug\HiSocket.dll
D:\MyGit\github\HiSocket\src\HiSocket\obj\Debug\HiSocket.pdb
Binary file modified src/HiSocket/obj/Debug/HiSocket.dll
Binary file not shown.
Binary file modified src/HiSocket/obj/Debug/HiSocket.pdb
Binary file not shown.
Binary file modified src/release/HiSocket.Message.dll
Binary file not shown.
Binary file modified src/release/HiSocket.Message.pdb
Binary file not shown.
Binary file modified src/release/HiSocket.dll
Binary file not shown.
Binary file modified src/release/HiSocket.pdb
Binary file not shown.
Binary file modified unity/Assets/HiSocket/HiSocket.Message.dll
Binary file not shown.
Binary file modified unity/Assets/HiSocket/HiSocket.Message.pdb
Binary file not shown.
Binary file modified unity/Assets/HiSocket/HiSocket.dll
Binary file not shown.
Binary file modified unity/Assets/HiSocket/HiSocket.pdb
Binary file not shown.

0 comments on commit 9612edb

Please sign in to comment.