#include <TCPGenericSrvThread.h>
Inheritance diagram for TCPGenericSrvThread:
Public Member Functions | |
TCPGenericSrvThread () | |
virtual void | established () |
virtual void | dataArrived (cMessage *msg, bool urgent) |
virtual void | timerExpired (cMessage *timer) |
|
00027 {}
|
|
Called when a data packet arrives. To be redefined. Implements TCPServerThreadBase. 00029 { 00030 GenericAppMsg *appmsg = dynamic_cast<GenericAppMsg *>(msg); 00031 if (!appmsg) 00032 opp_error("Message (%s)%s is not a GenericAppMsg -- " 00033 "probably wrong client app, or wrong setting of TCP's " 00034 "sendQueueClass/receiveQueueClass parameters " 00035 "(try \"TCPMsgBasedSendQueue\" and \"TCPMsgBasedRcvQueue\")", 00036 msg->className(), msg->name()); 00037 if (appmsg->replyDelay()>0) 00038 opp_error("Cannot process (%s)%s: %s class doesn't support replyDelay field" 00039 " of GenericAppMsg, try to use TCPGenericSrvApp instead", 00040 msg->className(), msg->name(), className()); 00041 00042 // process message: send back requested number of bytes, then close 00043 // connection if that was requested too 00044 long requestedBytes = appmsg->expectedReplyLength(); 00045 bool doClose = appmsg->close(); 00046 00047 if (requestedBytes==0) 00048 { 00049 delete msg; 00050 } 00051 else 00052 { 00053 msg->setByteLength(requestedBytes); 00054 delete msg->removeControlInfo(); 00055 socket()->send(msg); 00056 } 00057 00058 if (doClose) 00059 { 00060 socket()->close(); 00061 } 00062 }
|
|
Called when connection is established. To be redefined. Implements TCPServerThreadBase. 00024 {
00025 // no initialization needed
00026 }
|
|
Called when a timer (scheduled via scheduleAt()) expires. To be redefined. Implements TCPServerThreadBase. 00065 {
00066 // no timers in this serverThread
00067 }
|