public void Broadcast(byte channelID, ref Packet packet) { CheckCreated(); packet.CheckCreated(); Native.enet_host_broadcast(_host, channelID, packet.NativeData); packet.NativeData = null; // Broadcast automatically clears this. }
public void Broadcast(byte channelID, ref Packet packet, Peer[] peers) { CheckCreated(); packet.CheckCreated(); if (peers.Length > 0) { IntPtr[] nativePeers = ArrayPool.GetPointerBuffer(); int nativeCount = 0; for (int i = 0; i < peers.Length; i++) { if (peers[i].NativeData != IntPtr.Zero) { nativePeers[nativeCount] = peers[i].NativeData; nativeCount++; } } Native.enet_host_broadcast_selective(nativeHost, channelID, packet.NativeData, nativePeers, (IntPtr)nativeCount); } packet.NativeData = IntPtr.Zero; }
public void Broadcast(byte channelID, ref Packet packet) { CheckCreated(); packet.CheckCreated(); _host.Broadcast(channelID, packet.NativeData); packet.NativeData = null; }
public bool Send(byte channelID, ref Packet packet) { CheckCreated(); packet.CheckCreated(); return(Native.enet_peer_send(nativePeer, channelID, packet.NativeData) == 0); }
public void Broadcast(byte channelID, ref Packet packet, Peer excludedPeer) { CheckCreated(); packet.CheckCreated(); Native.enet_host_broadcast_exclude(nativeHost, channelID, packet.NativeData, excludedPeer.NativeData); packet.NativeData = IntPtr.Zero; }
// Added by Coburn. This version returns either 0 if the send was successful, // or the ENET return code if not. Sometimes a bool is not enough to determine // the root cause of the issue. public int SendAndReturnStatusCode(byte channelID, ref Packet packet) { CheckCreated(); packet.CheckCreated(); return(Native.enet_peer_send(nativePeer, channelID, packet.NativeData)); }
public bool Send(byte channelID, Packet packet) { CheckCreated(); packet.CheckCreated(); return Native.enet_peer_send(_peer, channelID, packet.NativeData) >= 0; }
public bool Send(byte channelID, Packet packet) { CheckCreated(); packet.CheckCreated(); return(_peer.Send(channelID, packet.NativeData) >= 0); }