Coder Social home page Coder Social logo

manistein / sparkserver Goto Github PK

View Code? Open in Web Editor NEW
265.0 11.0 49.0 17.65 MB

SparkServer是一个参照skynet设计的C#服务端框架,能够无缝整合到skynet集群机制中,也能自行组网,构建只有SparkServer节点的集群

License: MIT License

Makefile 0.64% C 58.31% C# 13.40% Shell 0.20% HTML 2.68% Lua 24.61% C++ 0.01% SourcePawn 0.01% Batchfile 0.12% M4 0.02%
game-server csharp mono cross-platform skynet actor-system rpc

sparkserver's Introduction

Manistein's github stats
Hi,大家好,我是《Lua解释器构建:从虚拟机到编译器》(机械工业出版社)的作者,欢迎大家关注我的新书~~
image
京东购买链接点击商店

sparkserver's People

Contributors

bme-ddb avatar manistein avatar morecolors avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sparkserver's Issues

Session Write的一个疑问

            int packetSize = buffer.Length;
            // big endian
            m_writeCache[0] = (byte)(packetSize >> 8);
            m_writeCache[1] = (byte)(packetSize & 0xff);

如果packetSize刚好位64*1024,那cache[0] = 0, cache[1]=0,那cache的前两位是用来存packetsize的,packetsize不就为0了吗?不知道是不是自己理解有问题

测试代码

using System;
namespace BigEndian
{
    public class Program
    {
        static void Main()
        {
            byte[] cache = new byte[2];
            int packetSize = 64*1024;
            //Console.WriteLine(Convert.ToString(packetSize, 2).PadLeft(32, '0'));
            var bytes = BitConverter.GetBytes(packetSize);
            Console.WriteLine("PacketSize "+BitConverter.ToString(bytes));

            int tmp = packetSize >> 8;
            Console.WriteLine(" >> 8 " + BitConverter.ToString(BitConverter.GetBytes(tmp)));

            tmp = packetSize & 0xff;
            Console.WriteLine(" 0xff " + BitConverter.ToString(BitConverter.GetBytes(tmp)));

            cache[0] = (byte)(packetSize >> 8);
            cache[1] = (byte)(packetSize & 0xff);
            Console.WriteLine("Cache "+BitConverter.ToString(cache));
        }
    }
} 

测试结果:

PacketSize 00-00-01-00
 >> 8 00-01-00-00
 0xff 00-00-00-00
Cache 00-00

build问题

我按照readme上的做法完成后尝试编译得到了这个问题

/usr/lib/mono/msbuild/15.0/bin/Microsoft.CSharp.CurrentVersion.targets(331,5): error MSB4019: The imported project "/usr/lib/mono/msbuild/15.0/bin/Roslyn/Microsoft.CSharp.Core.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [/home/xia0lei/elemental2_server/SparkServer/spark-server/server/SparkServer.csproj]

环境:centos 7

测试用例中GateWayCase的BUG和改正方法

Gateway测试用例中,客户端发送的字符串为"HelloHe...",而收到的是一段Base64编码的字符串,内容完全不同。
经查,原因在GateWayCase.cs中

SocketData函数中
`
List<byte[]> buffList = new List<byte[]>();

        buffList.Add(Encoding.ASCII.GetBytes(data.buffer));

        message.Buffers = buffList;`

改为
`
List<byte[]> buffList = new List<byte[]>();

        buffList.Add(Convert.FromBase64String(data.buffer));

        message.Buffers = buffList;`

即可。
(本来想提PR,但网络代理有点问题速度太慢)

一个框架使用的问题

我正在寻找一个c#的actor轻量服务器框架,也是因为战斗主要是用c#写的,您写的这个很适合我的需求,我在研读的过程中有一个关于项目实用的问题,您的gateclientcase里面我看到发送数据包是使用了框架里面的TcpClient类,那这个类中包含了Session, InBoundManager和OutBoundManager相关的类,我想请问下,就是使用发送数据包时,也是让Unity客户端的同学去使用TCPClient相关的类的吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.