资源简介
最近项目要用到Socket,遇到一些坑,比如频繁发消息 收消息,会产生粘包拆包等问题,还有断线重连的问题
代码片段和文件信息
#region Copyright notice and license
// Protocol Buffers - Google‘s data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms with or without
// modification are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// “AS IS“ AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL
// SPECIAL EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT
// LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE
// DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY WHETHER IN CONTRACT STRICT LIABILITY OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
namespace Google.Protobuf
{
///
/// Provides a utility routine to copy small arrays much more quickly than Buffer.BlockCopy
///
internal static class ByteArray
{
///
/// The threshold above which you should use Buffer.BlockCopy rather than ByteArray.Copy
///
private const int CopyThreshold = 12;
///
/// Determines which copy routine to use based on the number of bytes to be copied.
///
internal static void Copy(byte[] src int srcOffset byte[] dst int dstOffset int count)
{
if (count > CopyThreshold)
{
Buffer.BlockCopy(src srcOffset dst dstOffset count);
}
else
{
int stop = srcOffset + count;
for (int i = srcOffset; i < stop; i++)
{
dst[dstOffset++] = src[i];
}
}
}
///
/// Reverses the order of bytes in the array
///
internal static void Reverse(byte[] bytes)
{
for (int first = 0
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-02-21 12:10 Socket_Protobuff\
目录 0 2019-02-21 12:05 Socket_Protobuff\.vs\
目录 0 2019-02-21 12:05 Socket_Protobuff\.vs\Socket_Protobuff\
目录 0 2019-02-21 12:05 Socket_Protobuff\.vs\Socket_Protobuff\v15\
文件 120832 2019-02-21 12:10 Socket_Protobuff\.vs\Socket_Protobuff\v15\.suo
目录 0 2019-02-21 12:05 Socket_Protobuff\.vs\Socket_Protobuff\v15\Server\
目录 0 2019-02-21 12:06 Socket_Protobuff\.vs\Socket_Protobuff\v15\Server\sqlite3\
文件 0 2018-07-20 12:14 Socket_Protobuff\.vs\Socket_Protobuff\v15\Server\sqlite3\db.lock
文件 749568 2018-07-20 15:14 Socket_Protobuff\.vs\Socket_Protobuff\v15\Server\sqlite3\storage.ide
文件 32768 2019-02-21 12:06 Socket_Protobuff\.vs\Socket_Protobuff\v15\Server\sqlite3\storage.ide-shm
文件 774592 2019-02-21 12:10 Socket_Protobuff\.vs\Socket_Protobuff\v15\Server\sqlite3\storage.ide-wal
目录 0 2019-02-21 12:05 Socket_Protobuff\Assets\
文件 13472 2018-07-20 13:48 Socket_Protobuff\Assets\DEMO.unity
文件 174 2018-07-20 13:44 Socket_Protobuff\Assets\DEMO.unity.me
目录 0 2019-02-21 12:05 Socket_Protobuff\Assets\Plugins\
文件 191 2018-07-20 12:16 Socket_Protobuff\Assets\Plugins.me
目录 0 2019-02-21 12:05 Socket_Protobuff\Assets\Plugins\Google.Protobuf\
文件 191 2018-07-20 12:16 Socket_Protobuff\Assets\Plugins\Google.Protobuf.me
文件 3236 2018-05-02 17:10 Socket_Protobuff\Assets\Plugins\Google.Protobuf\ByteArray.cs
文件 274 2018-05-02 17:10 Socket_Protobuff\Assets\Plugins\Google.Protobuf\ByteArray.cs.me
文件 13162 2018-05-02 17:10 Socket_Protobuff\Assets\Plugins\Google.Protobuf\ByteString.cs
文件 274 2018-05-02 17:10 Socket_Protobuff\Assets\Plugins\Google.Protobuf\ByteString.cs.me
文件 48052 2018-05-02 17:10 Socket_Protobuff\Assets\Plugins\Google.Protobuf\CodedInputStream.cs
文件 274 2018-05-02 17:10 Socket_Protobuff\Assets\Plugins\Google.Protobuf\CodedInputStream.cs.me
文件 10658 2018-05-02 17:10 Socket_Protobuff\Assets\Plugins\Google.Protobuf\CodedOutputStream.ComputeSize.cs
文件 274 2018-05-02 17:10 Socket_Protobuff\Assets\Plugins\Google.Protobuf\CodedOutputStream.ComputeSize.cs.me
文件 28074 2018-07-17 14:34 Socket_Protobuff\Assets\Plugins\Google.Protobuf\CodedOutputStream.cs
文件 274 2018-05-02 17:10 Socket_Protobuff\Assets\Plugins\Google.Protobuf\CodedOutputStream.cs.me
目录 0 2019-02-21 12:05 Socket_Protobuff\Assets\Plugins\Google.Protobuf\Collections\
文件 200 2018-05-02 17:10 Socket_Protobuff\Assets\Plugins\Google.Protobuf\Collections.me
文件 29735 2018-05-02 17:10 Socket_Protobuff\Assets\Plugins\Google.Protobuf\Collections\MapField.cs
............此处省略809个文件信息
相关资源
- 通讯调试工具
- 安卓app之间的socket通信,支持多线程
- SocketCoder语音/视频会议模块源码2013
- 基于CSocket的局域网聊天和文件传输
- 通用TCP/UDP异步SOCKET通讯封装及Demo
- SocketTool(很好用的socket测试工具)
- DspSocketTest
- websocket实现单聊和群聊
- websocket服务端与客户端通信
- 基于socket实现Ping功能的源代码
- Linux网络编程-网络基础-socket编程-高并
- 基于DataSocket技术的LabVIEW远程测控.p
- WEB在线聊天系统源码
- Socket编程。ppt
- 第9章 基于C_S结构的Socket程序设计
- 黑马_Linux网络编程-网络基础-socket编程
- 基于HP-Socket的局域网通信工具仿QQ
- 安卓app软件通信cc3200
- Socket的TCP、UDP通讯
- socketdemo193608
- 局域网聊天工具socket通信技术
- 聊天 socket通信
- CSocket_Server.zip
- websocket向指定用户发信息
- Spring Boot整合websocket实现群聊,点对点
- socket 编程 tcp 实现文件上传
- Mqtt for Unity 完整工程包
- 安全的即时通信软件.zip
- SuperSocket带客户端和服务器端
- Visual Studio 实现TCp socket 异步通信,客
评论
共有 条评论