Пример #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
}
Пример #2
0
func doEnable() {
	C.NetworkWait(nil, C._16(local.max_clients), C.int(int(unsafe.Sizeof(&Network{}))/int(C.PTRSZVAL_sz)))
}
Пример #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
}