示例#1
0
文件: network.go 项目: d3x0r/SACK
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
文件: network.go 项目: d3x0r/SACK
func doEnable() {
	C.NetworkWait(nil, C._16(local.max_clients), C.int(int(unsafe.Sizeof(&Network{}))/int(C.PTRSZVAL_sz)))
}
示例#3
0
文件: network.go 项目: d3x0r/SACK
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
}