def sendraw(self, peer, data, channelid=0): if self.host is None: raise network.NotConnected("Server is not running") packet = enet.Packet(data, enet.PACKET_FLAG_RELIABLE) peer.send(channelid, packet) self.host.flush()
def send_packet(self, packet): """Send a packet to the server. packet has to be a subclass of `horizons.network.packets.packet`. """ if self.server_peer is None: raise network.NotConnected() packet = enet.Packet(packet.serialize(), enet.PACKET_FLAG_RELIABLE) self.server_peer.send(0, packet)
def send_raw(self, peer: 'enet.Peer', data: bytes): """ Sends raw data to a client. """ if self.host is None: raise network.NotConnected("Server is not running") packet = enet.Packet(data, enet.PACKET_FLAG_RELIABLE) peer.send(0, packet) self.host.flush()
def sendraw(peer, data, channelid=0): packet = enet.Packet(data, enet.PACKET_FLAG_RELIABLE) peer.send(channelid, packet)