FastEngine 0.9.4
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
C_server.inl
1/*
2 * Copyright 2025 Guillaume Guillet
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17namespace fge::net
18{
19
20//ClientSideNetUdp
21
22template<class TPacket>
23void ClientSideNetUdp::sendTo(TransmitPacketPtr& pck, Identity const& id)
24{
25 if (!pck->packet() || !pck->haveCorrectHeaderSize())
26 { //Last verification of the packet
27 return;
28 }
29
30 pck->doNotReorder();
31
32 std::scoped_lock const lock(this->_g_mutexFlux);
33 TPacket packet = pck->packet();
34 this->g_socket.sendTo(packet, id._ip, id._port);
35}
36
37} // namespace fge::net
void sendTo(TransmitPacketPtr &pck, Identity const &id)
Definition C_server.inl:23
A class to represent a client or server identity with an IP address and a port.
Definition C_identity.hpp:31