DEV Community

Andy Pan
Andy Pan

Posted on

4

【gnet】: Support Windows platform and add several codecs for encoding/decoding TCP frames

gnet

Github

https://github.com/panjf2000/gnet

Introduction

gnet is a high-performance(much better performance than the net package in Go), lightweight, non-blocking, event-driven networking framework written in pure Go, it supports Linux, freeBSD and Windows platforms now.
All features:

  • [x] High-performance event-loop under networking model of multiple threads/goroutines
  • [x] Built-in load balancing algorithm: Round-Robin
  • [x] Built-in goroutine pool powered by the library ants
  • [x] Built-in memory pool with bytes powered by the library pool
  • [x] Concise APIs
  • [x] Efficient memory usage: Ring-Buffer
  • [x] Supporting multiple protocols: TCP, UDP, and Unix Sockets
  • [x] Supporting two event-driven mechanisms: epoll on Linux and kqueue on FreeBSD
  • [x] Supporting asynchronous write operation
  • [x] Flexible ticker event
  • [x] SO_REUSEPORT socket option
  • [x] Built-in multiple codecs to encode/decode network frames into/from TCP stream: LineBasedFrameCodec, DelimiterBasedFrameCodec, FixedLengthFrameCodec and LengthFieldBasedFrameCodec, referencing netty codec, also supporting customized codecs
  • [x] Supporting Windows platform with event-driven mechanism of IOCP Go stdlib: net

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay