| Constructor and Description |
|---|
Ukcp(int conv,
KcpOutput output)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRecv()
Returns
true if there are bytes can be received. |
boolean |
canSend(boolean curCanSend)
Returns
true if the kcp can send more bytes. |
<T extends io.netty.channel.Channel> |
channel() |
Ukcp |
channel(io.netty.channel.Channel channel) |
int |
check(int current)
Determines when should you invoke udpate.
|
boolean |
checkFlush()
Returns
true if the kcp need to flush. |
int |
getConv()
Returns conv of kcp.
|
int |
getDeadLink() |
int |
getFastLimit() |
int |
getFastResend()
Returns the fastresend of kcp.
|
int |
getInterval()
Returns update interval.
|
int |
getMinRto() |
int |
getMtu() |
int |
getRcvWnd() |
int |
getSndWnd() |
int |
getState() |
int |
getTsUpdate() |
void |
input(io.netty.buffer.ByteBuf data) |
boolean |
isActive() |
boolean |
isAutoSetConv() |
boolean |
isFastFlush() |
boolean |
isMergeSegmentBuf() |
boolean |
isNocwnd() |
boolean |
isNodelay()
Returns
true if and only if nodelay is enabled. |
boolean |
isStream() |
void |
nodelay(boolean nodelay,
int interval,
int resend,
boolean nc)
Sets params of nodelay.
|
int |
peekSize()
The size of the first msg of the kcp.
|
void |
receive(io.netty.buffer.ByteBuf buf)
Receives ByteBufs.
|
void |
receive(List<io.netty.buffer.ByteBuf> bufList)
Receives ByteBufs.
|
void |
send(io.netty.buffer.ByteBuf buf)
Sends a Bytebuf.
|
Ukcp |
setAutoSetConv(boolean autoSetConv) |
Ukcp |
setByteBufAllocator(io.netty.buffer.ByteBufAllocator allocator)
Sets the
ByteBufAllocator which is used for the kcp to allocate buffers. |
void |
setConv(int conv)
Set the conv of kcp.
|
Ukcp |
setDeadLink(int deadLink) |
Ukcp |
setFastFlush(boolean fastFlush) |
Ukcp |
setFastLimit(int fastLimit) |
Ukcp |
setFastResend(int fastResend)
Sets the fastresend of kcp.
|
Ukcp |
setInterval(int interval)
Sets update interval
|
Ukcp |
setMergeSegmentBuf(boolean mergeSegmentBuf) |
Ukcp |
setMinRto(int minRto) |
Ukcp |
setMtu(int mtu) |
Ukcp |
setNocwnd(boolean nocwnd) |
Ukcp |
setNodelay(boolean nodelay)
Sets whether enable nodelay.
|
Ukcp |
setRcvWnd(int rcvWnd) |
Ukcp |
setSndWnd(int sndWnd) |
Ukcp |
setStream(boolean stream) |
Ukcp |
setTsUpdate(int tsUpdate) |
String |
toString() |
int |
update(int current)
Udpates the kcp.
|
int |
waitSnd() |
Ukcp |
wndSize(int sndWnd,
int rcvWnd) |
public Ukcp(int conv,
KcpOutput output)
conv - conv of kcpoutput - output for kcppublic void receive(io.netty.buffer.ByteBuf buf)
throws IOException
buf - IOExceptionpublic void receive(List<io.netty.buffer.ByteBuf> bufList)
bufList - received ByteBuf will be add to the listpublic void input(io.netty.buffer.ByteBuf data)
throws IOException
IOExceptionpublic void send(io.netty.buffer.ByteBuf buf)
throws IOException
buf - IOExceptionpublic int peekSize()
public boolean canRecv()
true if there are bytes can be received.public boolean canSend(boolean curCanSend)
true if the kcp can send more bytes.curCanSend - last state of canSendtrue if the kcp can send more bytespublic int update(int current)
current - current time in millisecondspublic int check(int current)
current - current time in millisecondsKcp.check(int)public boolean checkFlush()
true if the kcp need to flush.true if the kcp need to flushpublic void nodelay(boolean nodelay,
int interval,
int resend,
boolean nc)
nodelay - true if nodelay mode is enabledinterval - protocol internal work interval, in millisecondsresend - fast retransmission mode, 0 represents off by default, 2 can be set (2 ACK spans will result
in direct retransmission)nc - true if turn off flow controlpublic int getConv()
public void setConv(int conv)
conv - the conv of kcppublic boolean isNodelay()
true if and only if nodelay is enabled.true if and only if nodelay is enabledpublic Ukcp setNodelay(boolean nodelay)
nodelay - true if enable nodelaypublic int getInterval()
public Ukcp setInterval(int interval)
interval - update intervalpublic int getFastResend()
public Ukcp setFastResend(int fastResend)
fastResend - public int getFastLimit()
public Ukcp setFastLimit(int fastLimit)
public boolean isNocwnd()
public Ukcp setNocwnd(boolean nocwnd)
public int getMinRto()
public Ukcp setMinRto(int minRto)
public int getMtu()
public Ukcp setMtu(int mtu)
public boolean isStream()
public Ukcp setStream(boolean stream)
public int getDeadLink()
public Ukcp setDeadLink(int deadLink)
public Ukcp setByteBufAllocator(io.netty.buffer.ByteBufAllocator allocator)
ByteBufAllocator which is used for the kcp to allocate buffers.allocator - the allocator is used for the kcp to allocate bufferspublic boolean isAutoSetConv()
public Ukcp setAutoSetConv(boolean autoSetConv)
public Ukcp wndSize(int sndWnd, int rcvWnd)
public int waitSnd()
public int getRcvWnd()
public Ukcp setRcvWnd(int rcvWnd)
public int getSndWnd()
public Ukcp setSndWnd(int sndWnd)
public boolean isFastFlush()
public Ukcp setFastFlush(boolean fastFlush)
public boolean isMergeSegmentBuf()
public Ukcp setMergeSegmentBuf(boolean mergeSegmentBuf)
public int getTsUpdate()
public Ukcp setTsUpdate(int tsUpdate)
public int getState()
public boolean isActive()
public <T extends io.netty.channel.Channel> T channel()
public Ukcp channel(io.netty.channel.Channel channel)
Copyright © 2023. All rights reserved.