//UtpConnect starts to connect func (s *UtpSocket) UtpConnect(addr *net.UDPAddr) int64 { addrinfo := C.getAddrInfo(C.CString(addr.IP.String()), (C.int)(addr.Port)) size := C.utp_connect(s.s, addrinfo.ai_addr, (C.socklen_t)(addrinfo.ai_addrlen)) C.freeaddrinfo(addrinfo) return (int64)(size) }
//UtpProcessUDP process one udp packet func (ctx *UtpContext) UtpProcessUDP(buf []byte, addr *net.UDPAddr) int64 { addrinfo := C.getAddrInfo(C.CString(addr.IP.String()), (C.int)(addr.Port)) size := C.utp_process_udp(ctx.ctx, (*C.byte)(&buf[0]), (C.size_t)(len(buf)), addrinfo.ai_addr, (C.socklen_t)(addrinfo.ai_addrlen)) C.freeaddrinfo(addrinfo) return (int64)(size) }