/// <summary> /// Sends a message to a remote connection /// </summary> public void InformPunchthroughSuccess() { OutgoingMessage request = MessagePool.CreateMessage(); request.Write(NATMessageType.NAT_PUNCH_SUCCESS); fixed(byte *bytes = request.Data) { ENet.MicroSend(Peer, 0, bytes, (IntPtr)request.ByteCount, DeliveryMethod.Reliable); } MessagePool.Recycle(request); }
/// <summary> /// Sends a message to a remote connection. Default channel = 0 /// </summary> public void RequestHostList() { OutgoingMessage regMessage = MessagePool.CreateMessage(); regMessage.Write(NATMessageType.REQUEST_HOST_LIST); fixed(byte *bytes = regMessage.Data) { ENet.MicroSend(Peer, 0, bytes, (IntPtr)regMessage.ByteCount, DeliveryMethod.Reliable); } MessagePool.Recycle(regMessage); }
/// <summary> /// Sends a message to a remote connection. Default channel = 0 /// </summary> public void RegisterHosting() { OutgoingMessage regMessage = MessagePool.CreateMessage(); IPAddress local = NetUtilities.GetLocalAddress(); regMessage.Write(NATMessageType.INITIATE_HOST); regMessage.WriteString("hello"); fixed(byte *bytes = regMessage.Data) { ENet.MicroSend(Peer, 0, bytes, (IntPtr)regMessage.ByteCount, DeliveryMethod.Reliable); } MessagePool.Recycle(regMessage); }
/// <summary> /// Sends a message to a remote connection /// </summary> public void RequestIntroduction(ulong hostId) { OutgoingMessage request = MessagePool.CreateMessage(); // IPAddress local = NetUtilities.GetLocalAddress(); request.Write(NATMessageType.REQUEST_INTRODUCTION); request.Write(hostId); fixed(byte *bytes = request.Data) { ENet.MicroSend(Peer, 0, bytes, (IntPtr)request.ByteCount, DeliveryMethod.Reliable); } MessagePool.Recycle(request); }