Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TCPSinkApp Class Reference

#include <TCPSinkApp.h>

List of all members.


Detailed Description

Accepts any number of incoming connections, and discards whatever arrives on them.


Protected Member Functions

virtual void initialize ()
virtual void handleMessage (cMessage *msg)
virtual void finish ()

Protected Attributes

long bytesRcvd


Member Function Documentation

void TCPSinkApp::finish  )  [protected, virtual]
 

00064 {
00065     recordScalar("bytesRcvd", bytesRcvd);
00066 }

void TCPSinkApp::handleMessage cMessage *  msg  )  [protected, virtual]
 

00037 {
00038     if (msg->kind()==TCP_I_PEER_CLOSED)
00039     {
00040         // we close too
00041         msg->setKind(TCP_C_CLOSE);
00042         send(msg, "tcpOut");
00043     }
00044     else if (msg->kind()==TCP_I_DATA || msg->kind()==TCP_I_URGENT_DATA)
00045     {
00046         bytesRcvd += msg->byteLength();
00047         delete msg;
00048 
00049         if (ev.isGUI())
00050         {
00051             char buf[32];
00052             sprintf(buf, "rcvd: %ld bytes", bytesRcvd);
00053             displayString().setTagArg("t",0,buf);
00054         }
00055     }
00056     else
00057     {
00058         // must be data or some kind of indication -- can be dropped
00059         delete msg;
00060     }
00061 }

void TCPSinkApp::initialize  )  [protected, virtual]
 

00023 {
00024     const char *address = par("address");
00025     int port = par("port");
00026 
00027     bytesRcvd = 0;
00028     WATCH(bytesRcvd);
00029 
00030     TCPSocket socket;
00031     socket.setOutputGate(gate("tcpOut"));
00032     socket.bind(address[0] ? IPvXAddress(address) : IPvXAddress(), port);
00033     socket.listen();
00034 }


Member Data Documentation

long TCPSinkApp::bytesRcvd [protected]
 


The documentation for this class was generated from the following files:
Generated on Thu Oct 19 18:22:31 2006 for INET Framework for OMNeT++/OMNEST by  doxygen 1.4.0