Esempio n. 1
0
func ListenAt(listener IServerNetwork, addr *IPAddress) *Network {
	n := Network{server_callbacks: listener}

	C.OpenTCPListenerAddrExx((*C.SOCKADDR)(addr.addr), (*[0]byte)(C.ListenNotify_cgo))
	C.SetNetworkLong(n.pc, 0, C.PTRSZVAL(uintptr(unsafe.Pointer(&n))))
	return &n
}
Esempio n. 2
0
//export ListenCallback
func ListenCallback(l unsafe.Pointer, new_pclient C.PCLIENT) {
	var listener *Network  = (*Network)(l)

	//new_client.callbacks = listener.callbacks
	var new_client *Network
	var new_iClient IServerNetwork
	new_client, new_iClient = listener.server_callbacks.Create( )
	new_client <- c
	new_client.pc = new_pclient
	C.SetNetworkLong(new_pclient, 0, C.PTRSZVAL(uintptr(unsafe.Pointer(&new_client))))
	
	new_iClient.OnAccept()

}
Esempio 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
}