chronoxor / NetCoreServer

Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
https://chronoxor.github.io/NetCoreServer
MIT License
2.63k stars 550 forks source link

TCP OnReceived(buffer, 0, received); #293

Open jintemp opened 4 months ago

jintemp commented 4 months ago
    public virtual long Receive(byte[] buffer, long offset, long size)
    {
        if (!IsConnected)
            return 0;

        if (size == 0)
            return 0;

        // Receive data from the server
        long received = Socket.Receive(buffer, (int)offset, (int)size, SocketFlags.None, out SocketError ec);
        if (received > 0)
        {
            // Update statistic
            BytesReceived += received;

            // Call the buffer received handler
            OnReceived(buffer, 0, received);
        }

OnReceived(buffer, 0, received); This should be offset, not 0 Look forward to your reply

lifeengines commented 4 months ago

I also believe this is a bug, but it just so happens that in the original project, all the code that calls this place happens to pass zero.