Example server thread, to be used with TcpServerHostApp.
More...
#include <TcpGenericServerThread.h>
Example server thread, to be used with TcpServerHostApp.
◆ TcpGenericServerThread()
| inet::TcpGenericServerThread::TcpGenericServerThread |
( |
| ) |
|
|
inline |
◆ dataArrived()
| void inet::TcpGenericServerThread::dataArrived |
( |
Packet * |
msg, |
|
|
bool |
urgent |
|
) |
| |
|
overridevirtual |
Implements inet::TcpServerThreadBase.
25 const auto& appmsg = msg->peekData<GenericAppMsg>();
28 throw cRuntimeError(
"Message (%s)%s is not a GenericAppMsg -- probably wrong client app",
29 msg->getClassName(), msg->getName());
31 if (appmsg->getReplyDelay() > 0)
32 throw cRuntimeError(
"Cannot process (%s)%s: %s class doesn't support replyDelay field"
33 " of GenericAppMsg, try to use TcpGenericServerApp instead",
34 msg->getClassName(), msg->getName(), getClassName());
38 B requestedBytes = appmsg->getExpectedReplyLength();
39 bool doClose = appmsg->getServerClose();
41 if (requestedBytes >
B(0)) {
42 Packet *outPacket =
new Packet(msg->getName());
43 const auto& payload = makeShared<ByteCountChunk>(requestedBytes);
44 payload->addTag<CreationTimeTag>()->setCreationTime(simTime());
45 outPacket->insertAtBack(payload);
◆ established()
| void inet::TcpGenericServerThread::established |
( |
| ) |
|
|
overridevirtual |
◆ timerExpired()
| void inet::TcpGenericServerThread::timerExpired |
( |
cMessage * |
timer | ) |
|
|
overridevirtual |
The documentation for this class was generated from the following files: