MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / Send

Method Send

extensions/olcPGEX_Network.h:415–432  ·  view source on GitHub ↗

ASYNC - Send a message, connections are one-to-one so no need to specifiy the target, for a client, the target is the server and vice versa

Source from the content-addressed store, hash-verified

413 // ASYNC - Send a message, connections are one-to-one so no need to specifiy
414 // the target, for a client, the target is the server and vice versa
415 void Send(const message<T>& msg)
416 {
417 asio::post(m_asioContext,
418 [this, msg]()
419 {
420 // If the queue has a message in it, then we must
421 // assume that it is in the process of asynchronously being written.
422 // Either way add the message to the queue to be output. If no messages
423 // were available to be written, then start the process of writing the
424 // message at the front of the queue.
425 bool bWritingMessage = !m_qMessagesOut.empty();
426 m_qMessagesOut.push_back(msg);
427 if (!bWritingMessage)
428 {
429 WriteHeader();
430 }
431 });
432 }
433
434
435

Callers 3

SendMethod · 0.45
MessageClientMethod · 0.45
MessageAllClientsMethod · 0.45

Calls 2

emptyMethod · 0.80
push_backMethod · 0.80

Tested by

no test coverage detected