ikcp

package
v0.0.0-...-2197508 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2015 License: Apache-2.0, MIT Imports: 2 Imported by: 0

Documentation

Overview

=====================================================================

KCP - A Better ARQ Protocol Implementation skywind3000 (at) gmail.com, 2010-2011

Features: + Average RTT reduce 30% - 40% vs traditional ARQ like tcp. + Maximum RTT reduce three times vs tcp. + Lightweight, distributed as a single source file.

=====================================================================

Index

Constants

View Source
const (
	RTO_NDL     uint32 = 30  // no delay min rto
	RTO_MIN     uint32 = 100 // normal min rto
	RTO_DEF     uint32 = 200
	RTO_MAX     uint32 = 60000
	CMD_PUSH    uint32 = 81 // cmd: push data
	CMD_ACK     uint32 = 82 // cmd: ack
	CMD_WASK    uint32 = 83 // cmd: window probe (ask)
	CMD_WINS    uint32 = 84 // cmd: window size (tell)
	ASK_SEND    uint32 = 1  // need to send CMD_WASK
	ASK_TELL    uint32 = 2  // need to send CMD_WINS
	WND_SND     uint32 = 32
	WND_RCV     uint32 = 32
	MTU_DEF     uint32 = 1400
	ACK_FAST    uint32 = 3
	INTERVAL    uint32 = 100
	OVERHEAD    uint32 = 24
	DEADLINK    uint32 = 10
	THRESH_INIT uint32 = 2
	THRESH_MIN  uint32 = 2
	PROBE_INIT  uint32 = 7000   // 7 secs to probe window size
	PROBE_LIMIT uint32 = 120000 // up to 120 secs to probe window
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IKCPSEG

type IKCPSEG struct {
	// contains filtered or unexported fields
}

manage segment

type Ikcpcb

type Ikcpcb struct {
	Output func(buf []byte, _len int32, kcp *Ikcpcb, user interface{}) int32
	// contains filtered or unexported fields
}

func Create

func Create(conv uint32, user interface{}) *Ikcpcb

create a new kcpcb

func (*Ikcpcb) Check

func (kcp *Ikcpcb) Check(current uint32) uint32

func (*Ikcpcb) Flush

func (kcp *Ikcpcb) Flush()

Ikcp_flush

func (*Ikcpcb) Input

func (kcp *Ikcpcb) Input(data []byte, size int) int

input data

func (*Ikcpcb) Interval

func (kcp *Ikcpcb) Interval(interval int32) int32

func (*Ikcpcb) Nodelay

func (kcp *Ikcpcb) Nodelay(nodelay, interval, resend, nc int32) int32

func (*Ikcpcb) Peeksize

func (kcp *Ikcpcb) Peeksize() int32

send data

func (*Ikcpcb) Recv

func (kcp *Ikcpcb) Recv(buffer []byte, _len int32) int32

recv data

func (*Ikcpcb) Release

func (kcp *Ikcpcb) Release()

release a new kcpcb

func (*Ikcpcb) Send

func (kcp *Ikcpcb) Send(buffer []byte, _len int) int

send data

func (*Ikcpcb) Setmtu

func (kcp *Ikcpcb) Setmtu(mtu int32) int32

func (*Ikcpcb) Update

func (kcp *Ikcpcb) Update(current uint32)

input update

func (*Ikcpcb) UpdateAck

func (kcp *Ikcpcb) UpdateAck(rtt int32)

parse ack

func (*Ikcpcb) Waitsnd

func (kcp *Ikcpcb) Waitsnd() int32

func (*Ikcpcb) Wndsize

func (kcp *Ikcpcb) Wndsize(sndwnd, rcvwnd int32) int32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL