All Projects → PlaneZhong → Pesocket

PlaneZhong / Pesocket

Licence: mit
A C# Network Library.

Projects that are alternatives of or similar to Pesocket

Tinytcpserver
A small tcp server working under Mono or .NET (4.0) and provides hooks for handling data exchange with clients (works under mono and .net). Behaviour/protocol/reaction could be specified via custom C# script.
Stars: ✭ 14 (-89.55%)
Mutual labels:  server, network, socket, tcp-ip
Ether.network
https://github.com/Eastrall/Sylver
Stars: ✭ 147 (+9.7%)
Mutual labels:  server, network, socket
Zserver4d
ZServer4D 是一套从商业项目剥离而出的云服务器中间件,可以承载百万级的分布式负载服务,并且支持IoT及内网穿透
Stars: ✭ 199 (+48.51%)
Mutual labels:  server, network, socket
Hisocket
It is a lightweight client socket solution, you can used it in C# project or Unity3d
Stars: ✭ 275 (+105.22%)
Mutual labels:  unity3d, network, socket
Deta cache
缓存cache服务器
Stars: ✭ 106 (-20.9%)
Mutual labels:  server, network, socket
Clientserverproject
一个C-S模版,该模版由三部分的程序组成,一个服务端运行的程序,一个客户端运行的程序,还有一个公共的组件,实现了基础的账户管理功能,版本控制,软件升级,公告管理,消息群发,共享文件上传下载,批量文件传送功能。具体的操作方法见演示就行。本项目的一个目标是:提供一个基础的中小型系统的C-S框架,客户端有三种模式,无缝集成访问,winform版本,wpf版本,asp.net mvc版本,方便企业进行中小型系统的二次开发和个人学习。同时网络组件方便的支持读写三菱和西门子PLC的数据,详细见Readme
Stars: ✭ 873 (+551.49%)
Mutual labels:  server, network, socket
Go Raknet
An idiomatic Go library implementing a basic version of the RakNet protocol.
Stars: ✭ 40 (-70.15%)
Mutual labels:  server, network
Vibe Core
Repository for the next generation of vibe.d's core package.
Stars: ✭ 56 (-58.21%)
Mutual labels:  network, socket
Jstp
Fast RPC for browser and Node.js based on TCP, WebSocket, and MDSF
Stars: ✭ 132 (-1.49%)
Mutual labels:  server, socket
Fccss
Computer Science SCHOOL resources
Stars: ✭ 84 (-37.31%)
Mutual labels:  network, socket
C10k Server
A toy asynchronous server, written in C++14 (WIP)
Stars: ✭ 14 (-89.55%)
Mutual labels:  server, socket
Tinybirdnet Unity
A high level API for making networked games in Unity, utilizes https://github.com/RevenantX/LiteNetLib
Stars: ✭ 72 (-46.27%)
Mutual labels:  unity3d, network
X
新生命X组件,数据中间件XCode、日志、网络、RPC、序列化、缓存、Windows服务
Stars: ✭ 1,322 (+886.57%)
Mutual labels:  server, network
Cocoaasyncsocket demo
基于AsyncSocket搭建即时通讯体系 . 包含TCP连接 , 消息发送 , 消息接收 , 心跳处理 ,断网重连 , 消息超时 , 消息分发 , 数据库结构设计 , 消息丢失等 . 以及UI设计, 文本表情消息/语音消息/图片消息/视频消息/文件消息/撤回消息/提示语消息的实现思路讲解
Stars: ✭ 981 (+632.09%)
Mutual labels:  socket, tcp-ip
Zeus
A high performance, cross-platform Internet Communication Engine. Developed with native socket API. Aim at handling millions of concurrent connections.
Stars: ✭ 30 (-77.61%)
Mutual labels:  server, socket
Socketcluster Server
Minimal server module for SocketCluster
Stars: ✭ 70 (-47.76%)
Mutual labels:  server, socket
Cifsd
cifsd kernel server(SMB/CIFS server)
Stars: ✭ 76 (-43.28%)
Mutual labels:  server, network
Justniffer
Justniffer Just A Network TCP Packet Sniffer .Justniffer is a network protocol analyzer that captures network traffic and produces logs in a customized way, can emulate Apache web server log files, track response times and extract all "intercepted" files from the HTTP traffic
Stars: ✭ 115 (-14.18%)
Mutual labels:  network, tcp-ip
Ddn
DDN, Data Delivery Network, a next generation blockchain system
Stars: ✭ 118 (-11.94%)
Mutual labels:  server, network
Clusterws
💥 Lightweight, fast and powerful framework for building scalable WebSocket applications in Node.js
Stars: ✭ 868 (+547.76%)
Mutual labels:  server, socket

PESocket

基于C#语言实现的高效便捷网络库。支持集成到Unity当中使用。

不用过多了解网络通信内部原理,只需几行简单的代码,便能简捷快速开发基于C#语言的服务器和客户端,实现网络通信。

技术支持QQ:1785275942

使用示意:

1.创建Socket服务器

PESocket<ClientSession, NetMsg> client = new PESocket<ClientSession, NetMsg>();
client.StartAsServer("127.0.0.1", 17666);

2.创建Socket客户端

PESocket<ClientSession, NetMsg> client = new PESocket<ClientSession, NetMsg>();
client.StartAsClient("127.0.0.1", 17666);

3.网络消息定义

网络消息需要继承自PEMsg类,并打上[Serializable]标签,便于使用C#语言的序列化功能。消息体支持多层嵌套。

[Serializable]
public class NetMsg : PEMsg {
    public int id;
    public string name;
    public int coin;
}

4.发送网络消息

使用ClientSession/ServerSession类中的SendMsg(T msg)函数以及重载函数SendMsg(byte[] data)可以分别发送打包好的网络消息以及完成序列化二进制网络消息。

NetMsg msg = new NetMsg {
    id = 10086,
    name = "Plane",
    coin = 99999
};

this.SendMsg(msg);

5.接收网络消息

在自定义的ClientSession/ServerSession类中重写OnReciveMsg(T msg)可以接收网络消息。

protected override void OnReciveMsg(NetMsg msg) {
    base.OnReciveMsg(msg);

    //TODO 增加处理网络消息的业务逻辑
    PETool.LogMsg("Msg_id:" + msg.id);
    PETool.LogMsg("Msg_name:" + msg.name);
    PETool.LogMsg("Msg_coin:" + msg.coin);
}

6.第三方日志工具接口

通过SetLog(bool log = true, Action<string, int> logCB = null)接口,可以传入第三方的日志显示工具。(下面以Unity为例,实现在Unity编辑器控制台中输出日志信息)

skt.SetLog(true, (string msg, int lv) => {
    switch (lv) {
        case 0:
            msg = "Log:" + msg;
            Debug.Log(msg);
            break;
        case 1:
            msg = "Warn:" + msg;
            Debug.LogWarning(msg);
            break;
        case 2:
            msg = "Error:" + msg;
            Debug.LogError(msg);
            break;
        case 3:
            msg = "Info:" + msg;
            Debug.Log(msg);
            break;
    }
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].