Ejemplo n.º 1
0
func NewAddress(addr string, port int) *IPAddress {
	//C.char
	var result IPAddress = IPAddress{C.CreateSockAddress(C.CString(addr), C._16(port))}
	return &result
}
Ejemplo n.º 2
0
func doEnable() {
	C.NetworkWait(nil, C._16(local.max_clients), C.int(int(unsafe.Sizeof(&Network{}))/int(C.PTRSZVAL_sz)))
}
Ejemplo n.º 3
0
func Listen(listener IServerNetwork, port int) *Network {
	n := Network{server_callbacks: listener}
	n.pc = C.OpenTCPListenerExx(C._16(port), (*[0]byte)(C.ListenNotify_cgo))
	C.SetNetworkLong(n.pc, 0, C.PTRSZVAL(uintptr(unsafe.Pointer(&n))))
	return &n
}