From abf9ce14649002239e6273d256ad786c4ad98cb6 Mon Sep 17 00:00:00 2001 From: U2FsdGVkX1 Date: Sat, 10 Sep 2016 20:02:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eikcp=5Fsetoutput=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ikcp.c | 7 +++++++ ikcp.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/ikcp.c b/ikcp.c index e92fcb4..3edb43f 100644 --- a/ikcp.c +++ b/ikcp.c @@ -292,6 +292,13 @@ ikcpcb* ikcp_create(IUINT32 conv, void *user) return kcp; } +//--------------------------------------------------------------------- +// set output function +//--------------------------------------------------------------------- +void ikcp_setoutput(ikcpcb *kcp, int (*output)(const char *buf, int len, ikcpcb *kcp, void *user)) +{ + kcp->output = output; +} //--------------------------------------------------------------------- // release a new kcpcb diff --git a/ikcp.h b/ikcp.h index 9167236..9b92b16 100644 --- a/ikcp.h +++ b/ikcp.h @@ -333,6 +333,9 @@ extern "C" { // output callback can be setup like this: 'kcp->output = my_udp_output' ikcpcb* ikcp_create(IUINT32 conv, void *user); +// set output function +void ikcp_setoutput(ikcpcb *kcp, int (*output)(const char *buf, int len, ikcpcb *kcp, void *user)); + // release kcp control object void ikcp_release(ikcpcb *kcp);