Esempio n. 1
0
//UtpCreateSocket creates socket
func (ctx *UtpContext) UtpCreateSocket() *UtpSocket {
	s := C.utp_create_socket(ctx.ctx)
	sock := &UtpSocket{s: s}
	ctx.sockets[s] = sock
	sock.ctx = ctx
	return sock
}
Esempio n. 2
0
func NewUTPSocket(c *UTPContext) *UTPSocket {
	return &UTPSocket{
		ctx:  c,
		raw:  C.utp_create_socket(c.raw),
		lock: sync.Mutex{},
	}
}