Example server thread, to be used with TCPSrvHostApp.
More...
#include <TCPGenericSrvThread.h>
|
virtual void | socketDataArrived (int, void *, cPacket *msg, bool urgent) override |
|
virtual void | socketEstablished (int, void *) override |
|
virtual void | socketPeerClosed (int, void *) override |
|
virtual void | socketClosed (int, void *) override |
|
virtual void | socketFailure (int, void *, int code) override |
|
virtual void | socketStatusArrived (int, void *, TCPStatusInfo *status) override |
|
TCPSrvHostApp * | hostmod |
|
TCPSocket * | sock |
|
Example server thread, to be used with TCPSrvHostApp.
inet::TCPGenericSrvThread::TCPGenericSrvThread |
( |
| ) |
|
|
inline |
void inet::TCPGenericSrvThread::dataArrived |
( |
cMessage * |
msg, |
|
|
bool |
urgent |
|
) |
| |
|
overridevirtual |
Implements inet::TCPServerThreadBase.
33 GenericAppMsg *appmsg =
dynamic_cast<GenericAppMsg *
>(msg);
36 throw cRuntimeError(
"Message (%s)%s is not a GenericAppMsg -- " 37 "probably wrong client app, or wrong setting of TCP's " 38 "dataTransferMode parameters " 40 msg->getClassName(), msg->getName());
42 if (appmsg->getReplyDelay() > 0)
43 throw cRuntimeError(
"Cannot process (%s)%s: %s class doesn't support replyDelay field" 44 " of GenericAppMsg, try to use TCPGenericSrvApp instead",
45 msg->getClassName(), msg->getName(), getClassName());
49 long requestedBytes = appmsg->getExpectedReplyLength();
50 bool doClose = appmsg->getServerClose();
52 if (requestedBytes == 0) {
56 appmsg->setByteLength(requestedBytes);
57 delete appmsg->removeControlInfo();
virtual TCPSocket * getSocket()
Definition: TCPSrvHostApp.h:87
void send(cMessage *msg)
Sends data packet.
Definition: TCPSocket.cc:175
void close()
Closes the local end of the connection.
Definition: TCPSocket.cc:192
void inet::TCPGenericSrvThread::established |
( |
| ) |
|
|
overridevirtual |
void inet::TCPGenericSrvThread::timerExpired |
( |
cMessage * |
timer | ) |
|
|
overridevirtual |
The documentation for this class was generated from the following files: