Kcp 类
Kcp
实现
继承成员
命名空间: KCP
程序集: Fantasy.Net.dll
语法
public sealed class Kcp : IDisposable
构造函数
| 编辑本文 查看源代码Kcp(KcpCallback)
Structure
声明
public Kcp(KcpCallback output)
参数
类型 | 名称 | 描述 |
---|---|---|
KcpCallback | output | Output |
Kcp(uint, KcpCallback)
Structure
声明
public Kcp(uint conv, KcpCallback output)
参数
类型 | 名称 | 描述 |
---|---|---|
uint | conv | ConversationId |
KcpCallback | output | Output |
属性
| 编辑本文 查看源代码AckBlock
Number of acknowledge blocks
声明
public uint AckBlock { get; }
属性值
类型 | 描述 |
---|---|
uint |
AckCount
Count of acknowledges
声明
public uint AckCount { get; }
属性值
类型 | 描述 |
---|---|
uint |
AckList
Pointer to the acknowledge list
声明
public uint* AckList { get; }
属性值
类型 | 描述 |
---|---|
uint* |
Buffer
Buffer
声明
public byte[] Buffer { get; }
属性值
类型 | 描述 |
---|---|
byte[] |
CongestionWindowSize
Congestion window size
声明
public uint CongestionWindowSize { get; }
属性值
类型 | 描述 |
---|---|
uint |
ConversationId
Conversation id
声明
public uint ConversationId { get; }
属性值
类型 | 描述 |
---|---|
uint |
Current
Current timestamp
声明
public uint Current { get; }
属性值
类型 | 描述 |
---|---|
uint |
FastResend
Fast resend trigger count
声明
public int FastResend { get; }
属性值
类型 | 描述 |
---|---|
int |
FastResendLimit
Fast resend limit
声明
public int FastResendLimit { get; }
属性值
类型 | 描述 |
---|---|
int |
Increment
Incremental increase
声明
public uint Increment { get; }
属性值
类型 | 描述 |
---|---|
uint |
Interval
Flush interval
声明
public uint Interval { get; }
属性值
类型 | 描述 |
---|---|
uint |
IsSet
Set
声明
public bool IsSet { get; }
属性值
类型 | 描述 |
---|---|
bool |
MaximumSegmentSize
Maximum segment size
声明
public uint MaximumSegmentSize { get; }
属性值
类型 | 描述 |
---|---|
uint |
MaximumTransmissionUnit
Maximum transmission unit
声明
public uint MaximumTransmissionUnit { get; }
属性值
类型 | 描述 |
---|---|
uint |
NoCongestionWindow
Whether congestion control is disabled
声明
public int NoCongestionWindow { get; }
属性值
类型 | 描述 |
---|---|
int |
NoDelay
Whether Nagle's algorithm is disabled
声明
public uint NoDelay { get; }
属性值
类型 | 描述 |
---|---|
uint |
Output
Output function pointer
声明
public KcpCallback Output { get; }
属性值
类型 | 描述 |
---|---|
KcpCallback |
Probe
Probe variable for fast recovery
声明
public uint Probe { get; }
属性值
类型 | 描述 |
---|---|
uint |
ProbeWait
Probe wait time
声明
public uint ProbeWait { get; }
属性值
类型 | 描述 |
---|---|
uint |
ReceiveBufferCount
Number of packets in the receive buffer
声明
public uint ReceiveBufferCount { get; }
属性值
类型 | 描述 |
---|---|
uint |
ReceiveNext
The sequence number for the next packet expected to be received
声明
public uint ReceiveNext { get; }
属性值
类型 | 描述 |
---|---|
uint |
ReceiveQueueCount
Number of packets in the receive queue
声明
public uint ReceiveQueueCount { get; }
属性值
类型 | 描述 |
---|---|
uint |
ReceiveWindowSize
Receive window size
声明
public uint ReceiveWindowSize { get; }
属性值
类型 | 描述 |
---|---|
uint |
RemoteWindowSize
Remote window size
声明
public uint RemoteWindowSize { get; }
属性值
类型 | 描述 |
---|---|
uint |
RxMinrto
Minimum retransmission timeout
声明
public int RxMinrto { get; }
属性值
类型 | 描述 |
---|---|
int |
RxRto
Retransmission timeout
声明
public int RxRto { get; }
属性值
类型 | 描述 |
---|---|
int |
RxRttval
Round-trip time variance
声明
public int RxRttval { get; }
属性值
类型 | 描述 |
---|---|
int |
RxSrtt
Smoothed round-trip time
声明
public int RxSrtt { get; }
属性值
类型 | 描述 |
---|---|
int |
SendBufferCount
Number of packets in the send buffer
声明
public uint SendBufferCount { get; }
属性值
类型 | 描述 |
---|---|
uint |
SendNext
The sequence number for the next packet to be sent
声明
public uint SendNext { get; }
属性值
类型 | 描述 |
---|---|
uint |
SendQueueCount
Number of packets in the send queue
声明
public uint SendQueueCount { get; }
属性值
类型 | 描述 |
---|---|
uint |
SendUna
The sequence number of the first unacknowledged packet
声明
public uint SendUna { get; }
属性值
类型 | 描述 |
---|---|
uint |
SendWindowSize
Send window size
声明
public uint SendWindowSize { get; }
属性值
类型 | 描述 |
---|---|
uint |
SlowStartThreshold
Slow start threshold for congestion control
声明
public uint SlowStartThreshold { get; }
属性值
类型 | 描述 |
---|---|
uint |
State
Connection state
声明
public int State { get; }
属性值
类型 | 描述 |
---|---|
int |
StreamMode
Whether stream mode is enabled
声明
public int StreamMode { get; }
属性值
类型 | 描述 |
---|---|
int |
TimestampFlush
Timestamp for the next flush
声明
public uint TimestampFlush { get; }
属性值
类型 | 描述 |
---|---|
uint |
TimestampProbe
Timestamp for the next probe
声明
public uint TimestampProbe { get; }
属性值
类型 | 描述 |
---|---|
uint |
Transmissions
Number of retransmissions
声明
public uint Transmissions { get; }
属性值
类型 | 描述 |
---|---|
uint |
Updated
Whether the KCP connection has been updated
声明
public uint Updated { get; }
属性值
类型 | 描述 |
---|---|
uint |
WaitReceiveCount
Number of packets wait to receive
声明
public uint WaitReceiveCount { get; }
属性值
类型 | 描述 |
---|---|
uint |
WaitSendCount
Number of packets wait to send
声明
public uint WaitSendCount { get; }
属性值
类型 | 描述 |
---|---|
uint |
方法
| 编辑本文 查看源代码Check(uint)
Check
声明
public uint Check(uint current)
参数
类型 | 名称 | 描述 |
---|---|---|
uint | current | Timestamp |
返回
类型 | 描述 |
---|---|
uint | Next flush timestamp |
Dispose()
Dispose
声明
public void Dispose()
~Kcp()
Destructure
声明
protected ~Kcp()
Flush()
Flush
声明
public void Flush()
Input(ArraySegment<byte>)
Input
声明
public int Input(ArraySegment<byte> buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
ArraySegment<byte> | buffer | Buffer |
返回
类型 | 描述 |
---|---|
int | Input bytes |
Input(byte*, int)
Input
声明
public int Input(byte* buffer, int length)
参数
类型 | 名称 | 描述 |
---|---|---|
byte* | buffer | Buffer |
int | length | Length |
返回
类型 | 描述 |
---|---|
int | Input bytes |
Input(byte*, int, int)
Input
声明
public int Input(byte* buffer, int offset, int length)
参数
类型 | 名称 | 描述 |
---|---|---|
byte* | buffer | Buffer |
int | offset | Offset |
int | length | Length |
返回
类型 | 描述 |
---|---|
int | Input bytes |
Input(byte[])
Input
声明
public int Input(byte[] buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
byte[] | buffer | Buffer |
返回
类型 | 描述 |
---|---|
int | Input bytes |
Input(byte[], int)
Input
声明
public int Input(byte[] buffer, int length)
参数
类型 | 名称 | 描述 |
---|---|---|
byte[] | buffer | Buffer |
int | length | Length |
返回
类型 | 描述 |
---|---|
int | Input bytes |
Input(byte[], int, int)
Input
声明
public int Input(byte[] buffer, int offset, int length)
参数
类型 | 名称 | 描述 |
---|---|---|
byte[] | buffer | Buffer |
int | offset | Offset |
int | length | Length |
返回
类型 | 描述 |
---|---|
int | Input bytes |
Input(ReadOnlyMemory<byte>)
Input
声明
public int Input(ReadOnlyMemory<byte> buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
ReadOnlyMemory<byte> | buffer | Buffer |
返回
类型 | 描述 |
---|---|
int | Input bytes |
Input(ReadOnlySpan<byte>)
Input
声明
public int Input(ReadOnlySpan<byte> buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
ReadOnlySpan<byte> | buffer | Buffer |
返回
类型 | 描述 |
---|---|
int | Input bytes |
PeekSize()
Peek size
声明
public int PeekSize()
返回
类型 | 描述 |
---|---|
int | Peeked size |
Receive(ArraySegment<byte>)
Receive
声明
public int Receive(ArraySegment<byte> buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
ArraySegment<byte> | buffer | Buffer |
返回
类型 | 描述 |
---|---|
int | Received bytes |
Receive(byte*, int)
Receive
声明
public int Receive(byte* buffer, int length)
参数
类型 | 名称 | 描述 |
---|---|---|
byte* | buffer | Buffer |
int | length | Length |
返回
类型 | 描述 |
---|---|
int | Received bytes |
Receive(byte*, int, int)
Receive
声明
public int Receive(byte* buffer, int offset, int length)
参数
类型 | 名称 | 描述 |
---|---|---|
byte* | buffer | Buffer |
int | offset | Offset |
int | length | Length |
返回
类型 | 描述 |
---|---|
int | Received bytes |
Receive(byte[])
Receive
声明
public int Receive(byte[] buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
byte[] | buffer | Buffer |
返回
类型 | 描述 |
---|---|
int | Received bytes |
Receive(byte[], int)
Receive
声明
public int Receive(byte[] buffer, int length)
参数
类型 | 名称 | 描述 |
---|---|---|
byte[] | buffer | Buffer |
int | length | Length |
返回
类型 | 描述 |
---|---|
int | Received bytes |
Receive(byte[], int, int)
Receive
声明
public int Receive(byte[] buffer, int offset, int length)
参数
类型 | 名称 | 描述 |
---|---|---|
byte[] | buffer | Buffer |
int | offset | Offset |
int | length | Length |
返回
类型 | 描述 |
---|---|
int | Received bytes |
Receive(Memory<byte>)
Receive
声明
public int Receive(Memory<byte> buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
Memory<byte> | buffer | Buffer |
返回
类型 | 描述 |
---|---|
int | Received bytes |
Receive(Span<byte>)
Receive
声明
public int Receive(Span<byte> buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
Span<byte> | buffer | Buffer |
返回
类型 | 描述 |
---|---|
int | Received bytes |
Send(ArraySegment<byte>)
Send
声明
public int Send(ArraySegment<byte> buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
ArraySegment<byte> | buffer | Buffer |
返回
类型 | 描述 |
---|---|
int | Sent bytes |
Send(byte*, int)
Send
声明
public int Send(byte* buffer, int length)
参数
类型 | 名称 | 描述 |
---|---|---|
byte* | buffer | Buffer |
int | length | Length |
返回
类型 | 描述 |
---|---|
int | Sent bytes |
Send(byte*, int, int)
Send
声明
public int Send(byte* buffer, int offset, int length)
参数
类型 | 名称 | 描述 |
---|---|---|
byte* | buffer | Buffer |
int | offset | Offset |
int | length | Length |
返回
类型 | 描述 |
---|---|
int | Sent bytes |
Send(byte[])
Send
声明
public int Send(byte[] buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
byte[] | buffer | Buffer |
返回
类型 | 描述 |
---|---|
int | Sent bytes |
Send(byte[], int)
Send
声明
public int Send(byte[] buffer, int length)
参数
类型 | 名称 | 描述 |
---|---|---|
byte[] | buffer | Buffer |
int | length | Length |
返回
类型 | 描述 |
---|---|
int | Sent bytes |
Send(byte[], int, int)
Send
声明
public int Send(byte[] buffer, int offset, int length)
参数
类型 | 名称 | 描述 |
---|---|---|
byte[] | buffer | Buffer |
int | offset | Offset |
int | length | Length |
返回
类型 | 描述 |
---|---|
int | Sent bytes |
Send(ReadOnlyMemory<byte>)
Send
声明
public int Send(ReadOnlyMemory<byte> buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
ReadOnlyMemory<byte> | buffer | Buffer |
返回
类型 | 描述 |
---|---|
int | Sent bytes |
Send(ReadOnlySpan<byte>)
Send
声明
public int Send(ReadOnlySpan<byte> buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
ReadOnlySpan<byte> | buffer | Buffer |
返回
类型 | 描述 |
---|---|
int | Sent bytes |
SetFastResendLimit(int)
Set fast resend limit
声明
public void SetFastResendLimit(int fastlimit)
参数
类型 | 名称 | 描述 |
---|---|---|
int | fastlimit | Fast resend limit |
SetInterval(int)
Set flush interval
声明
public void SetInterval(int interval)
参数
类型 | 名称 | 描述 |
---|---|---|
int | interval | Flush interval |
SetMinrto(int)
Set minimum retransmission timeout
声明
public void SetMinrto(int minrto)
参数
类型 | 名称 | 描述 |
---|---|---|
int | minrto | Minimum retransmission timeout |
SetMtu(int)
Set maximum transmission unit
声明
public int SetMtu(int mtu)
参数
类型 | 名称 | 描述 |
---|---|---|
int | mtu | Maximum transmission unit |
返回
类型 | 描述 |
---|---|
int | Set |
SetNoDelay(int, int, int, int)
Set no delay
声明
public void SetNoDelay(int nodelay, int interval, int resend, int nc)
参数
类型 | 名称 | 描述 |
---|---|---|
int | nodelay | Whether Nagle's algorithm is disabled |
int | interval | Flush interval |
int | resend | Fast resend trigger count |
int | nc | No congestion window |
SetOutput(KcpCallback)
Set output
声明
public void SetOutput(KcpCallback output)
参数
类型 | 名称 | 描述 |
---|---|---|
KcpCallback | output | Output |
SetStreamMode(int)
Set whether stream mode is enabled
声明
public void SetStreamMode(int stream)
参数
类型 | 名称 | 描述 |
---|---|---|
int | stream | Whether stream mode is enabled |
SetWindowSize(int, int)
Set window size
声明
public void SetWindowSize(int sndwnd, int rcvwnd)
参数
类型 | 名称 | 描述 |
---|---|---|
int | sndwnd | Send window size |
int | rcvwnd | Receive window size |
Update(uint)
Update
声明
public void Update(uint current)
参数
类型 | 名称 | 描述 |
---|---|---|
uint | current | Timestamp |