TCPP2P 文件传输

This commit is contained in:
sin365 2023-06-16 18:04:08 +08:00
parent a0eaa236ae
commit 4379be7793
36 changed files with 2925 additions and 102 deletions

Binary file not shown.

Binary file not shown.

View File

@ -66,6 +66,15 @@ while (true)
}
App.p2pChat.SendChatMsg(Convert.ToInt64(CmdArr[1]), CmdArr[2]);
break;
case "tufile":
case "tuf":
if (CmdArr.Length < 3)
{
Console.WriteLine("缺省参数");
return;
}
App.p2pFile.sender_FilePushConfirmToTarget(Convert.ToInt64(CmdArr[1]), CmdArr[2]);
break;
case "ulist":
{
UserInfo[] ulist = App.userMgr.GetUserInfo();

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -18,6 +19,7 @@ namespace ClientCore
public static ClientManager clientMgr;
public static P2PTcp p2ptcp;
public static P2PChat p2pChat;
public static P2PFile p2pFile;
public static NetworkHelper networkMain;
public static NetworkHelper networkTcp2S;
public static AppLogin login;
@ -34,6 +36,7 @@ namespace ClientCore
clientMgr.SetIpData(IP, port, tcptunnelport);
p2ptcp = new P2PTcp();
p2pChat = new P2PChat();
p2pFile = new P2PFile();
networkMain = new NetworkHelper(Enum.ServerType.MainServer);
networkMain.Init(IP, port);
//networkTcp2S = new NetworkHelper(Enum.ServerType.TcpTunnelServer);

View File

@ -21,5 +21,7 @@ namespace ClientCore.Event
//连接管理
OnSocketConnect,
OnSocketDisconnect,
//文件传输
}
}

View File

@ -3,8 +3,10 @@ using ClientCore.Common;
using ClientCore.Enum;
using ClientCore.Event;
using ClientCore.Network;
using HaoYueNet.ClientNetwork;
using System.Net.Sockets;
using System.Timers;
using static System.Runtime.CompilerServices.RuntimeHelpers;
namespace ClientCore.Manager
{
@ -16,7 +18,7 @@ namespace ClientCore.Manager
int tcptunnelport;
int LastlocalPort = 0;
Dictionary<long,NetworkHelper> DictUID2TcpTaret = new Dictionary<long,NetworkHelper>();
Dictionary<long, NetworkP2PHelper> DictUID2TcpTaret = new Dictionary<long, NetworkP2PHelper>();
public ClientManager()
{
@ -130,7 +132,7 @@ namespace ClientCore.Manager
#region P2PTarget
void AddTargetSocket(NetworkHelper targetSocket)
void AddTargetSocket(NetworkP2PHelper targetSocket)
{
DictUID2TcpTaret[targetSocket.mUID] = targetSocket;
}
@ -143,7 +145,7 @@ namespace ClientCore.Manager
}
}
NetworkHelper GetTargetSocket(long UID)
NetworkP2PHelper GetTargetSocket(long UID)
{
if (DictUID2TcpTaret.ContainsKey(UID))
{
@ -151,19 +153,19 @@ namespace ClientCore.Manager
}
return null;
}
/// <summary>
/// 发送给指定UID消息
/// </summary>
/// <param name="UID"></param>
/// <param name="CMDID"></param>
/// <param name="data"></param>
public void SendToTargetSocket(long UID,int CMDID,byte[] data)
public void SendToTargetSocket(long UID, int CMDID, int ERRCODE, byte[] data)
{
NetworkHelper target = GetTargetSocket(UID);
NetworkP2PHelper target = GetTargetSocket(UID);
if (target == null)
return;
target.SendToServer((int)CMDID, data);
target.SendToSocket((int)CMDID, ERRCODE, data);
}
#endregion
@ -184,7 +186,7 @@ namespace ClientCore.Manager
int userBindPort = LastlocalPort;
Protobuf_TcpTunnel_DoTunnel_RESP msg = (Protobuf_TcpTunnel_DoTunnel_RESP)obj;
Console.WriteLine("LocalEndPoint Port" + userBindPort);
NetworkHelper targetSocket = new NetworkHelper(Enum.ServerType.TcpP2PTarget, msg.TargetUID);
NetworkP2PHelper targetSocket = new NetworkP2PHelper(Enum.ServerType.TcpP2PTarget, msg.TargetUID);
targetSocket.Init(msg.OtherIP, msg.OtherPort, true, userBindPort);
//尝试5次连接
for (int j = 0; j < 5; j++)

View File

@ -17,7 +17,7 @@ namespace ClientCore.Manager
{
ChatMsg = ChatMsg,
};
App.clientMgr.SendToTargetSocket(UID, (int)CommandID.CmdTcpP2PChat, ProtoBufHelper.Serizlize(msg));
App.clientMgr.SendToTargetSocket(UID, (int)CommandID.CmdTcpP2PChat,(int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(msg));
}
public void RecvChatMsg(long uid, byte[] reqData)
{

View File

@ -0,0 +1,408 @@
using AxibugProtobuf;
using ClientCore.Common;
using ClientCore.Event;
using ClientCore.Network;
using Google.Protobuf;
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace ClientCore.Manager
{
public class P2PFile
{
public int cPackSize = 5 * 1024;
public int WaitSendPackCount = 100;
//是否自动同意接收
public bool bAutoRecv = true;
public P2PFile()
{
//发送者协议注册
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTcpP2PFilepushConfirmResp, RecvTcpP2PFilepushConfirmResp);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTcpP2PFilepushResp, RecvTcpP2PFilepushResp);
//接收者协议注册
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTcpP2PFilepushConfirm, RecvTcpP2PFilepushConfirm);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTcpP2PFilepush, RecvTcpP2PFilepush);
}
#region
public void SendFilePushConfirm(long UID, FilePushTask taskinfo)
{
Protobuf_TcpP2P_FilePushConfirm msg = new Protobuf_TcpP2P_FilePushConfirm()
{
TaskID = taskinfo.TaskID,
PackSize = taskinfo.PackSize,
ContentType = taskinfo.ContentType,
FileHash = taskinfo.FileHash,
FileLenght = taskinfo.FileLenght,
FileName = taskinfo.FileName,
PackCount = taskinfo.PackCount,
};
App.clientMgr.SendToTargetSocket(UID, (int)CommandID.CmdTcpP2PFilepushConfirm, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(msg));
}
public void SendFilePush(long UID,int TaskID, long Index, byte[] data, int dataLength)
{
Protobuf_TcpP2P_FilePush msg = new Protobuf_TcpP2P_FilePush()
{
TaskID = TaskID,
PackIndex = Index,
PackLenght= dataLength,
FileData = ByteString.CopyFrom(data)
};
App.clientMgr.SendToTargetSocket(UID, (int)CommandID.CmdTcpP2PFilepush, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(msg));
}
void RecvTcpP2PFilepushConfirmResp(long uid, byte[] reqData)
{
Protobuf_TcpP2P_FilePushConfirm_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_TcpP2P_FilePushConfirm_RESP>(reqData);
// 开始发送
if (msg.Agree == 1)
{
sender_AgreeRecvFile(msg.TaskID);
}
else
{
//TODO 被拒绝
}
}
void RecvTcpP2PFilepushResp(long uid, byte[] reqData)
{
//收到回执信息
Protobuf_TcpP2P_FilePush_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_TcpP2P_FilePush_RESP>(reqData);
sender_StartPushFileThread(msg.TaskID, msg.FinishIndex);
}
#endregion
#region
Dictionary<int, FilePushTask> DictTaskID2Task_SendReady = new Dictionary<int, FilePushTask>();
Dictionary<int, FilePushTask> DictTaskID2Task_SendDo = new Dictionary<int, FilePushTask>();
/// <summary>
/// 发送者发送文件请求
/// </summary>
/// <param name="UID"></param>
/// <param name="path"></param>
public void sender_FilePushConfirmToTarget(long UID, string path)
{
FileInfo finfo = new FileInfo(path);
//向上取整
long packCount = (long)Math.Ceiling(finfo.Length / (float)cPackSize);
FilePushTask ftask = new FilePushTask()
{
TaskID = 1,//TODO
fromUID = App.userMgr.MainPlayer.UID,
targetUID = UID,
Path = path,
FileName = finfo.Name,
PackSize = cPackSize,
PackCount = packCount,
FileLenght = finfo.Length,
FileHash = "",//TODO
ContentType = "",//TODO
CurrIndex = -1,
ConfirmIndex= -1,
};
SendFilePushConfirm(UID, ftask);
DictTaskID2Task_SendReady[ftask.TaskID] = ftask;
}
public void sender_AgreeRecvFile(int TaskID)
{
if (DictTaskID2Task_SendReady.ContainsKey(TaskID))
{
FilePushTask task = DictTaskID2Task_SendReady[TaskID];
DictTaskID2Task_SendDo[TaskID] = task;
DictTaskID2Task_SendReady.Remove(TaskID);
sender_StartPushFile(TaskID);
}
}
//开始发送文件传输
void sender_StartPushFile(int TaskID)
{
if (!DictTaskID2Task_SendDo.ContainsKey(TaskID))
{
return;
}
FilePushTask task = DictTaskID2Task_SendDo[TaskID];
Thread thread = new Thread(sender_StartPushFileThread);
thread.IsBackground = true;
thread.Start(TaskID);
}
void sender_StartPushFileThread(int TaskID,long Index)
{
if (!DictTaskID2Task_SendDo.ContainsKey(TaskID))
return;
DictTaskID2Task_SendDo[TaskID].ConfirmIndex = Index;
}
/// <summary>
/// 开始发送线程用
/// </summary>
/// <param name="obj"></param>
void sender_StartPushFileThread(object obj)
{
int TaskID = (int)obj;
if (!DictTaskID2Task_SendDo.ContainsKey(TaskID))
return;
FilePushTask task = DictTaskID2Task_SendDo[TaskID];
//构造读取文件流对象
using (FileStream fsRead = new FileStream(task.Path, FileMode.Open)) //打开文件,不能创建新的
{
//开辟临时缓存内存
byte[] byteArrayRead = new byte[cPackSize]; // 1字节*1024 = 1k 1k*1024 = 1M内存
App.log.Debug($"[文件发送者]开始发送文件!!");
//通过死缓存去读文本中的内容
while (true)
{
//若发送下标,大于确认下标一定数量,则等待
while (task.CurrIndex - task.ConfirmIndex > WaitSendPackCount)
{
Thread.Sleep(10);
}
//readCount 这个是保存真正读取到的字节数
int readCount = fsRead.Read(byteArrayRead, 0, byteArrayRead.Length);
//TODO 大小
//if (readCount == cPackSize)
//{
//}
//else
//{
//}
task.CurrIndex++;
SendFilePush(task.targetUID, TaskID, task.CurrIndex, byteArrayRead, readCount);
//App.log.Debug($"发送文件片段,下标->{task.CurrIndex}");
//既然是死循环 那么什么时候我们停止读取文本内容 我们知道文本最后一行的大小肯定是小于缓存内存大小的
if (readCount < byteArrayRead.Length)
{
App.log.Debug($"[文件发送者]文件发送完毕!! task.CurrIndex->{task.CurrIndex}");
DictTaskID2Task_SendDo.Remove(TaskID);
fsRead.Close();
break; //结束循环
}
}
}
}
#endregion
#region
/// <summary>
///
/// </summary>
/// <param name="UID"></param>
/// <param name="TaskID"></param>
/// <param name="bAgree">[1]同意 [0]拒绝</param>
public void SendFilePushConfirm_Resp(long UID, int TaskID, int bAgree)
{
Protobuf_TcpP2P_FilePushConfirm_RESP msg = new Protobuf_TcpP2P_FilePushConfirm_RESP()
{
TaskID = TaskID,
Agree = bAgree
};
App.clientMgr.SendToTargetSocket(UID, (int)CommandID.CmdTcpP2PFilepushConfirmResp, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(msg));
}
/// <summary>
///
/// </summary>
/// <param name="UID"></param>
/// <param name="TaskID"></param>
/// <param name="Index"></param>
public void SendFilePush_Resp(long UID, int TaskID, long Index)
{
Protobuf_TcpP2P_FilePush_RESP msg = new Protobuf_TcpP2P_FilePush_RESP()
{
TaskID = TaskID,
FinishIndex = Index
};
App.clientMgr.SendToTargetSocket(UID, (int)CommandID.CmdTcpP2PFilepushResp, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(msg));
}
void RecvTcpP2PFilepushConfirm(long uid, byte[] reqData)
{
Protobuf_TcpP2P_FilePushConfirm msg = ProtoBufHelper.DeSerizlize<Protobuf_TcpP2P_FilePushConfirm>(reqData);
receiver_AddRecvFileReady(new FilePushTask()
{
TaskID = msg.TaskID,
PackSize = cPackSize,
ContentType = msg.ContentType,
FileHash = msg.FileHash,
FileLenght = msg.FileLenght,
FileName = msg.FileName,
PackCount = msg.PackCount,
Path = "",//待插入
fromUID = uid,
targetUID = App.userMgr.MainPlayer.UID,
CurrIndex = -1,
ConfirmIndex= -1,//虽然用不上
});
//TODO 事件 EventSystem.Instance.PostEvent(EEvent.OnP2PChatMsg, uid, msg.ChatMsg);
}
void RecvTcpP2PFilepush(long uid, byte[] reqData)
{
Protobuf_TcpP2P_FilePush msg = ProtoBufHelper.DeSerizlize<Protobuf_TcpP2P_FilePush>(reqData);
if (!DictTaskID2Task_RecvDataQueue.ContainsKey(msg.TaskID))
return;
if (msg == null)
{
}
DictTaskID2Task_RecvDataQueue[msg.TaskID].Enqueue(msg);
}
#endregion
#region
Dictionary<int, FilePushTask> DictTaskID2Task_RecvReady = new Dictionary<int, FilePushTask>();
Dictionary<int, FilePushTask> DictTaskID2Task_RecvDo = new Dictionary<int, FilePushTask>();
Dictionary<int, Queue<Protobuf_TcpP2P_FilePush>> DictTaskID2Task_RecvDataQueue = new Dictionary<int, Queue<Protobuf_TcpP2P_FilePush>>();
/// <summary>
/// 接收数据准备
/// </summary>
/// <param name="task"></param>
void receiver_AddRecvFileReady(FilePushTask task)
{
DictTaskID2Task_RecvReady[task.TaskID] = task;
//自动接收文件
if (bAutoRecv)
{
receiver_AgreeRecvFile(task.TaskID);
}
}
/// <summary>
/// 同意文件传输
/// </summary>
/// <param name="TaskID"></param>
public void receiver_AgreeRecvFile(int TaskID)
{
if (DictTaskID2Task_RecvReady.ContainsKey(TaskID))
{
FilePushTask task = DictTaskID2Task_RecvReady[TaskID];
DictTaskID2Task_RecvDo[TaskID] = task;
DictTaskID2Task_RecvReady.Remove(TaskID);
receiver_StartRecvFile(TaskID);
App.log.Debug("[文件接收者]:发送同意接收");
SendFilePushConfirm_Resp(task.fromUID, task.TaskID, 1);
}
}
/// <summary>
/// 开始接收文件传输
/// </summary>
/// <param name="TaskID"></param>
void receiver_StartRecvFile(int TaskID)
{
if (!DictTaskID2Task_RecvDo.ContainsKey(TaskID))
{
return;
}
FilePushTask task = DictTaskID2Task_RecvDo[TaskID];
DictTaskID2Task_RecvDataQueue[TaskID] = new Queue<Protobuf_TcpP2P_FilePush>();
Thread thread = new Thread(receiver_StartRecvFileThread);
thread.IsBackground = true;
thread.Start(TaskID);
App.log.Debug("[文件接收者]:准备接收线程");
}
/// <summary>
/// 接收任务线程
/// </summary>
/// <param name="obj"></param>
void receiver_StartRecvFileThread(object obj)
{
int TaskID = (int)obj;
FilePushTask task = null;
if (!DictTaskID2Task_RecvDo.ContainsKey(TaskID))
return;
task = DictTaskID2Task_RecvDo[TaskID];
string fullpath = System.Environment.CurrentDirectory + "//" + task.FileName;
FileInfo myFile = new FileInfo(fullpath);
FileStream fs = myFile.Create();
//int WriteLenght = 0;
//TODO 打开文件写入
while (true)
{
Queue<Protobuf_TcpP2P_FilePush> dataqueue = DictTaskID2Task_RecvDataQueue[TaskID];
bool bflag = false;
while (dataqueue.Count > 0)
{
Protobuf_TcpP2P_FilePush msg = dataqueue.Dequeue();
if (msg == null)
continue;
bflag = true;
byte[] bytedata = msg.FileData.ToArray();
if (msg.PackIndex - task.CurrIndex != 1)
{
App.log.Error($"[文件接收者]接收下标错误msg.PackIndex->{msg.PackIndex} task.CurrIndex=>{task.CurrIndex}");
}
//写入文件
fs.Write(bytedata, 0, msg.PackLenght);
//WriteLenght += msg.PackLenght;
task.CurrIndex = msg.PackIndex;
//todo 写入片段
//更新进度
//App.log.Debug($"[文件接收者]收到文件片段,下标->{task.CurrIndex}");
}
if (bflag)
{
//回执收到信息
SendFilePush_Resp(task.fromUID, TaskID, task.CurrIndex);
}
if (task.CurrIndex + 1 >= task.PackCount)
{
//文件接收完毕
App.log.Debug($"[文件接收者]文件接收完毕!! task.CurrIndex->{task.CurrIndex} task.PackCount->{task.PackCount}");
//删除进行中字典
DictTaskID2Task_RecvDo.Remove(TaskID);
//删除进行中数据队列
DictTaskID2Task_RecvDataQueue.Remove(TaskID);
break;
}
Thread.Sleep(10);
}
//TODO 结束写入
fs.Close();
}
#endregion
}
public class FilePushTask
{
public int TaskID;//传输任务ID
public long fromUID;//发送者UID
public long targetUID;
public string Path;
public long FileLenght;//文件长度
public string ContentType;//ContentType
public string FileName;//文件名
public int PackSize;//每个包大小
public long PackCount;//包数量
public string FileHash;//文件hash
public long CurrIndex;
public long ConfirmIndex;
}
}

View File

@ -62,7 +62,7 @@ namespace ClientCore.Network
/// <param name="data">业务数据</param>
public void GetDataCallBack(int CMDID, int ERRCODE, byte[] data)
{
NetworkDeBugLog("收到消息 CMDID =>" + CMDID + " ERRCODE =>" + ERRCODE + " 数据长度=>" + data.Length);
//NetworkDeBugLog("收到消息 CMDID =>" + CMDID + " ERRCODE =>" + ERRCODE + " 数据长度=>" + data.Length);
try
{
//抛出网络数据

View File

@ -0,0 +1,94 @@
using AxibugProtobuf;
using ClientCore.Enum;
using ClientCore.Event;
using HaoYueNet.ClientNetwork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ClientCore.Network
{
/// <summary>
/// 继承网络库,以支持网络功能
/// </summary>
public class NetworkP2PHelper : NetworkHelperP2PCore
{
ServerType mServerType;
public long mUID { get; private set; } = -1;
public NetworkP2PHelper(ServerType serverType,long UID = -1)
{
//指定接收服务器数据事件
OnDataCallBack += GetDataCallBack;
//断开连接
OnClose += OnConnectClose;
//网络库调试信息输出事件,用于打印连接断开,收发事件
OnLogOut += NetworkDeBugLog;
OnConnected += NetworkConnected;
mServerType = serverType;
mUID = UID;
}
public void NetworkConnected(bool IsConnect)
{
if (IsConnect)
{
EventSystem.Instance.PostEvent(EEvent.OnSocketConnect, mServerType, true);
NetworkDeBugLog("服务器连接成功");
}
else
{
EventSystem.Instance.PostEvent(EEvent.OnSocketConnect, mServerType, false);
NetworkDeBugLog("服务器连接失败");
//to do 重连逻辑
}
}
public void NetworkDeBugLog(string str)
{
//用于Unity内的输出
//Debug.Log("NetCoreDebug >> "+str);
Console.WriteLine("NetCoreDebug >> " + str);
}
/// <summary>
/// 接受包回调
/// </summary>
/// <param name="CMDID">协议ID</param>
/// <param name="ERRCODE">错误编号</param>
/// <param name="data">业务数据</param>
public void GetDataCallBack(int CMDID, int ERRCODE, byte[] data)
{
//NetworkDeBugLog("收到消息 CMDID =>" + CMDID + " ERRCODE =>" + ERRCODE + " 数据长度=>" + data.Length);
try
{
//抛出网络数据
if (mServerType == ServerType.TcpP2PTarget)
{
NetMsg.Instance.PostNetMsgEvent(CMDID, mUID,data);
}
else
{
NetMsg.Instance.PostNetMsgEvent(CMDID, data);
}
}
catch (Exception ex)
{
NetworkDeBugLog("逻辑处理错误:" + ex.ToString());
}
}
/// <summary>
/// 关闭连接
/// </summary>
public void OnConnectClose()
{
NetworkDeBugLog("OnConnectClose");
EventSystem.Instance.PostEvent(EEvent.OnSocketDisconnect, mServerType, mUID);
}
}
}

View File

@ -1,17 +0,0 @@
F:\Sin365\HaoYueTunnel\ClientCore\bin\Debug\net7.0\ClientCore.deps.json
F:\Sin365\HaoYueTunnel\ClientCore\bin\Debug\net7.0\ClientCore.dll
F:\Sin365\HaoYueTunnel\ClientCore\bin\Debug\net7.0\ClientCore.pdb
F:\Sin365\HaoYueTunnel\ClientCore\bin\Debug\net7.0\Google.Protobuf.dll
F:\Sin365\HaoYueTunnel\ClientCore\bin\Debug\net7.0\HaoYueNet.ClientNetwork.dll
F:\Sin365\HaoYueTunnel\ClientCore\bin\Debug\net7.0\Protobuf.dll
F:\Sin365\HaoYueTunnel\ClientCore\bin\Debug\net7.0\Protobuf.pdb
F:\Sin365\HaoYueTunnel\ClientCore\obj\Debug\net7.0\ClientCore.csproj.AssemblyReference.cache
F:\Sin365\HaoYueTunnel\ClientCore\obj\Debug\net7.0\ClientCore.GeneratedMSBuildEditorConfig.editorconfig
F:\Sin365\HaoYueTunnel\ClientCore\obj\Debug\net7.0\ClientCore.AssemblyInfoInputs.cache
F:\Sin365\HaoYueTunnel\ClientCore\obj\Debug\net7.0\ClientCore.AssemblyInfo.cs
F:\Sin365\HaoYueTunnel\ClientCore\obj\Debug\net7.0\ClientCore.csproj.CoreCompileInputs.cache
F:\Sin365\HaoYueTunnel\ClientCore\obj\Debug\net7.0\ClientCore.csproj.CopyComplete
F:\Sin365\HaoYueTunnel\ClientCore\obj\Debug\net7.0\ClientCore.dll
F:\Sin365\HaoYueTunnel\ClientCore\obj\Debug\net7.0\refint\ClientCore.dll
F:\Sin365\HaoYueTunnel\ClientCore\obj\Debug\net7.0\ClientCore.pdb
F:\Sin365\HaoYueTunnel\ClientCore\obj\Debug\net7.0\ref\ClientCore.dll

Binary file not shown.

View File

@ -34,18 +34,21 @@ namespace AxibugProtobuf {
"EgsKA1VJRBgFIAEoAxIQCghOaWNrTmFtZRgGIAEoCSIjChBQcm90b2J1Zl9D",
"aGF0TXNnEg8KB0NoYXRNc2cYASABKAkiSAoVUHJvdG9idWZfQ2hhdE1zZ19S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TSF9SRVNQEPxVKj4KCUVycm9yQ29kZRIQCgxFUlJPUl9ERUZBVUwQABIM",
"CghFUlJPUl9PSxABEhEKDUVSUk9SX05PVEZJTkQQZCo+CglMb2dpblR5cGUS",
"DwoLQmFzZURlZmF1bHQQABIOCgpIYW9ZdWVBdXRoEAESBwoDQkYzEAMSBwoD",
"QkY0EAQqSwoKRGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQABIG",
"CgJQQxABEgsKB0FuZHJvaWQQAhIHCgNJT1MQAxIHCgNQU1YQBCpOChFMb2dp",
"blJlc3VsdFN0YXR1cxIhCh1Mb2dpblJlc3VsdFN0YXR1c19CYXNlRGVmYXVs",
"dBAAEgYKAk9LEAESDgoKQWNjb3VudEVychACQgJIAWIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] {
@ -100,6 +103,22 @@ namespace AxibugProtobuf {
///TCPP2P聊天 Protobuf_TcpP2P_Chat
/// </summary>
[pbr::OriginalName("CMD_TCP_P2P_CHAT")] CmdTcpP2PChat = 10001,
/// <summary>
///TCPP2P 文件传输上下行分开
/// </summary>
[pbr::OriginalName("CMD_TCP_P2P_FILEPUSH_CONFIRM")] CmdTcpP2PFilepushConfirm = 11001,
/// <summary>
///TCPP2文件传输 下行 对应 Protobuf_TcpP2P_FilePushConfirm_RESP
/// </summary>
[pbr::OriginalName("CMD_TCP_P2P_FILEPUSH_CONFIRM_RESP")] CmdTcpP2PFilepushConfirmResp = 11002,
/// <summary>
///TCPP2文件传输 过程 上行 对应 Protobuf_TcpP2P_FilePush
/// </summary>
[pbr::OriginalName("CMD_TCP_P2P_FILEPUSH")] CmdTcpP2PFilepush = 11003,
/// <summary>
///TCPP2文件传输 过程 下行 对应 Protobuf_TcpP2P_FilePush_RESP
/// </summary>
[pbr::OriginalName("CMD_TCP_P2P_FILEPUSH_RESP")] CmdTcpP2PFilepushResp = 11004,
}
public enum ErrorCode {

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +0,0 @@
F:\Sin365\HaoYueTunnel\Protobuf\bin\Debug\net7.0\Protobuf.deps.json
F:\Sin365\HaoYueTunnel\Protobuf\bin\Debug\net7.0\Protobuf.dll
F:\Sin365\HaoYueTunnel\Protobuf\bin\Debug\net7.0\Protobuf.pdb
F:\Sin365\HaoYueTunnel\Protobuf\bin\Debug\net7.0\Google.Protobuf.dll
F:\Sin365\HaoYueTunnel\Protobuf\obj\Debug\net7.0\Protobuf.csproj.AssemblyReference.cache
F:\Sin365\HaoYueTunnel\Protobuf\obj\Debug\net7.0\Protobuf.GeneratedMSBuildEditorConfig.editorconfig
F:\Sin365\HaoYueTunnel\Protobuf\obj\Debug\net7.0\Protobuf.AssemblyInfoInputs.cache
F:\Sin365\HaoYueTunnel\Protobuf\obj\Debug\net7.0\Protobuf.AssemblyInfo.cs
F:\Sin365\HaoYueTunnel\Protobuf\obj\Debug\net7.0\Protobuf.csproj.CoreCompileInputs.cache
F:\Sin365\HaoYueTunnel\Protobuf\obj\Debug\net7.0\Protobuf.csproj.CopyComplete
F:\Sin365\HaoYueTunnel\Protobuf\obj\Debug\net7.0\Protobuf.dll
F:\Sin365\HaoYueTunnel\Protobuf\obj\Debug\net7.0\refint\Protobuf.dll
F:\Sin365\HaoYueTunnel\Protobuf\obj\Debug\net7.0\Protobuf.pdb
F:\Sin365\HaoYueTunnel\Protobuf\obj\Debug\net7.0\ref\Protobuf.dll

View File

@ -34,18 +34,21 @@ namespace AxibugProtobuf {
"EgsKA1VJRBgFIAEoAxIQCghOaWNrTmFtZRgGIAEoCSIjChBQcm90b2J1Zl9D",
"aGF0TXNnEg8KB0NoYXRN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FVTSBD7VRIeChlDTURfVENQX1AyUF9GSUxF",
"UFVTSF9SRVNQEPxVKj4KCUVycm9yQ29kZRIQCgxFUlJPUl9ERUZBVUwQABIM",
"CghFUlJPUl9PSxABEhEKDUVSUk9SX05PVEZJTkQQZCo+CglMb2dpblR5cGUS",
"DwoLQmFzZURlZmF1bHQQABIOCgpIYW9ZdWVBdXRoEAESBwoDQkYzEAMSBwoD",
"QkY0EAQqSwoKRGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQABIG",
"CgJQQxABEgsKB0FuZHJvaWQQAhIHCgNJT1MQAxIHCgNQU1YQBCpOChFMb2dp",
"blJlc3VsdFN0YXR1cxIhCh1Mb2dpblJlc3VsdFN0YXR1c19CYXNlRGVmYXVs",
"dBAAEgYKAk9LEAESDgoKQWNjb3VudEVychACQgJIAWIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] {
@ -100,6 +103,22 @@ namespace AxibugProtobuf {
///TCPP2P聊天 Protobuf_TcpP2P_Chat
/// </summary>
[pbr::OriginalName("CMD_TCP_P2P_CHAT")] CmdTcpP2PChat = 10001,
/// <summary>
///TCPP2P 文件传输上下行分开
/// </summary>
[pbr::OriginalName("CMD_TCP_P2P_FILEPUSH_CONFIRM")] CmdTcpP2PFilepushConfirm = 11001,
/// <summary>
///TCPP2文件传输 下行 对应 Protobuf_TcpP2P_FilePushConfirm_RESP
/// </summary>
[pbr::OriginalName("CMD_TCP_P2P_FILEPUSH_CONFIRM_RESP")] CmdTcpP2PFilepushConfirmResp = 11002,
/// <summary>
///TCPP2文件传输 过程 上行 对应 Protobuf_TcpP2P_FilePush
/// </summary>
[pbr::OriginalName("CMD_TCP_P2P_FILEPUSH")] CmdTcpP2PFilepush = 11003,
/// <summary>
///TCPP2文件传输 过程 下行 对应 Protobuf_TcpP2P_FilePush_RESP
/// </summary>
[pbr::OriginalName("CMD_TCP_P2P_FILEPUSH_RESP")] CmdTcpP2PFilepushResp = 11004,
}
public enum ErrorCode {

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,12 @@ enum CommandID
CMD_TCPTUNNEL_DO = 5002; //TCP打洞请求 Protobuf_TcpTunnel_DoTunnel | Protobuf_TcpTunnel_DoTunnel_RESP
CMD_TCP_P2P_CHAT = 10001; //TCPP2P聊天 Protobuf_TcpP2P_Chat
//TCPP2P
CMD_TCP_P2P_FILEPUSH_CONFIRM = 11001; //TCPP2文件传输 Protobuf_TcpP2P_FilePushConfirm
CMD_TCP_P2P_FILEPUSH_CONFIRM_RESP = 11002; //TCPP2文件传输 Protobuf_TcpP2P_FilePushConfirm_RESP
CMD_TCP_P2P_FILEPUSH = 11003; //TCPP2文件传输 Protobuf_TcpP2P_FilePush
CMD_TCP_P2P_FILEPUSH_RESP = 11004; //TCPP2文件传输 Protobuf_TcpP2P_FilePush_RESP
}
enum ErrorCode

View File

@ -40,3 +40,38 @@ message Protobuf_TcpP2P_Chat
string ChatMsg = 1;//
}
////////////////////////////TCP P2P文件传输//////////////////
//TCPP2P文件传输
message Protobuf_TcpP2P_FilePushConfirm
{
int64 FileLenght = 1;//
string ContentType = 2;//ContentType
string FileName = 3;//
int32 TaskID = 4;//ID
int32 PackSize = 5;//
int64 PackCount = 6;//
string FileHash = 7;//hash
}
message Protobuf_TcpP2P_FilePushConfirm_RESP
{
int32 TaskID = 1;//ID
int32 Agree = 2;//[0] [1]
}
//TCPP2P文件传输
message Protobuf_TcpP2P_FilePush
{
int32 TaskID = 1;//ID
int64 PackIndex = 2;//
bytes File_Data = 3;//
int32 PackLenght = 4;//
}
message Protobuf_TcpP2P_FilePush_RESP
{
int32 TaskID = 1;//ID
int64 FinishIndex = 2;//
}

View File

@ -1,22 +0,0 @@
F:\Sin365\HaoYueTunnel\Server\bin\Debug\net7.0\Server.exe
F:\Sin365\HaoYueTunnel\Server\bin\Debug\net7.0\Server.deps.json
F:\Sin365\HaoYueTunnel\Server\bin\Debug\net7.0\Server.runtimeconfig.json
F:\Sin365\HaoYueTunnel\Server\bin\Debug\net7.0\Server.dll
F:\Sin365\HaoYueTunnel\Server\bin\Debug\net7.0\Server.pdb
F:\Sin365\HaoYueTunnel\Server\bin\Debug\net7.0\Protobuf.dll
F:\Sin365\HaoYueTunnel\Server\bin\Debug\net7.0\ServerCore.dll
F:\Sin365\HaoYueTunnel\Server\bin\Debug\net7.0\HaoYueNet.ServerNetwork.dll
F:\Sin365\HaoYueTunnel\Server\bin\Debug\net7.0\Google.Protobuf.dll
F:\Sin365\HaoYueTunnel\Server\bin\Debug\net7.0\ServerCore.pdb
F:\Sin365\HaoYueTunnel\Server\bin\Debug\net7.0\Protobuf.pdb
F:\Sin365\HaoYueTunnel\Server\obj\Debug\net7.0\Server.csproj.AssemblyReference.cache
F:\Sin365\HaoYueTunnel\Server\obj\Debug\net7.0\Server.GeneratedMSBuildEditorConfig.editorconfig
F:\Sin365\HaoYueTunnel\Server\obj\Debug\net7.0\Server.AssemblyInfoInputs.cache
F:\Sin365\HaoYueTunnel\Server\obj\Debug\net7.0\Server.AssemblyInfo.cs
F:\Sin365\HaoYueTunnel\Server\obj\Debug\net7.0\Server.csproj.CoreCompileInputs.cache
F:\Sin365\HaoYueTunnel\Server\obj\Debug\net7.0\Server.csproj.CopyComplete
F:\Sin365\HaoYueTunnel\Server\obj\Debug\net7.0\Server.dll
F:\Sin365\HaoYueTunnel\Server\obj\Debug\net7.0\refint\Server.dll
F:\Sin365\HaoYueTunnel\Server\obj\Debug\net7.0\Server.pdb
F:\Sin365\HaoYueTunnel\Server\obj\Debug\net7.0\Server.genruntimeconfig.cache
F:\Sin365\HaoYueTunnel\Server\obj\Debug\net7.0\ref\Server.dll

View File

@ -1,17 +0,0 @@
F:\Sin365\HaoYueTunnel\ServerCore\bin\Debug\net7.0\ServerCore.deps.json
F:\Sin365\HaoYueTunnel\ServerCore\bin\Debug\net7.0\ServerCore.dll
F:\Sin365\HaoYueTunnel\ServerCore\bin\Debug\net7.0\ServerCore.pdb
F:\Sin365\HaoYueTunnel\ServerCore\bin\Debug\net7.0\Google.Protobuf.dll
F:\Sin365\HaoYueTunnel\ServerCore\bin\Debug\net7.0\HaoYueNet.ServerNetwork.dll
F:\Sin365\HaoYueTunnel\ServerCore\bin\Debug\net7.0\Protobuf.dll
F:\Sin365\HaoYueTunnel\ServerCore\bin\Debug\net7.0\Protobuf.pdb
F:\Sin365\HaoYueTunnel\ServerCore\obj\Debug\net7.0\ServerCore.csproj.AssemblyReference.cache
F:\Sin365\HaoYueTunnel\ServerCore\obj\Debug\net7.0\ServerCore.GeneratedMSBuildEditorConfig.editorconfig
F:\Sin365\HaoYueTunnel\ServerCore\obj\Debug\net7.0\ServerCore.AssemblyInfoInputs.cache
F:\Sin365\HaoYueTunnel\ServerCore\obj\Debug\net7.0\ServerCore.AssemblyInfo.cs
F:\Sin365\HaoYueTunnel\ServerCore\obj\Debug\net7.0\ServerCore.csproj.CoreCompileInputs.cache
F:\Sin365\HaoYueTunnel\ServerCore\obj\Debug\net7.0\ServerCore.csproj.CopyComplete
F:\Sin365\HaoYueTunnel\ServerCore\obj\Debug\net7.0\ServerCore.dll
F:\Sin365\HaoYueTunnel\ServerCore\obj\Debug\net7.0\refint\ServerCore.dll
F:\Sin365\HaoYueTunnel\ServerCore\obj\Debug\net7.0\ServerCore.pdb
F:\Sin365\HaoYueTunnel\ServerCore\obj\Debug\net7.0\ref\ServerCore.dll