资源简介
最近项目要用到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个文件信息
相关资源
- 通信软件的具体实例──基于Socket的
- 用Socket编程实现FTP
- websocket实现一对一聊天
- 代码客:G-TcpServer(IOCP) 1.0 正式版及
- SOCKET 网络编程 计算机网络 作业 客户
- linux 网络实验 ftp程序
- 用Socket写的简易FTP服务器和客户端
- socket小工具(可方便建立TCP UDP的soc
- socket客户端源码
- 基于CSocket的多人聊天室
- socket文件传输源码
- Socket自制系统
- HP用SOCKET实现(客户端---服务端)
- zeromq的windows版本安装包
- STM32分别以串口硬件SPI模拟并口驱动
- 《TCP/IP:协议分析与应用编程》课后
- linux下基于socket和curses的双人弹球游戏
- 计算机网络socket编程实验
- linux下socket can 编程详解
- FANUC机器人Socket Message通讯设置及使用
- Delphi简单实现局域网远程开机
- 易语言websocket服务器源码
- websocket规范 RFC6455 中文版
- 富士康H61S主板最新BIOS,支持22NCPU
- Socket-UDP整合消息接收,发送
- websocket-rtsp-proxy-test.zip
- 基于QTsocket的局域网聊天室
- SuperSocket服务端与客户端通信
- 网络编程socket文件图片等传送
- tomcat7.0.42 下部署websocket需要替换的包
评论
共有 条评论