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);