[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Re: TCP split connections mechanism



Hi!

Sorry for the delayed response...

I actually haven't found anything publicly available. 
However I have implemented a splitting mechanism myself. 
It is part of a project involving more than just connection
splitting. At the moment the code is not publicly available, 
but it will be soon. 

I implemented connection splitting by defining a new TCP Sink
class. This class just adds a pointer to an agent object
(called forwarder). The new sink's recvbytes() calls the forwarder's 
sendmsg(). 

Check the following:

// Declaration
//

class SplitTcpSink : public virtual DelAckSink { 
public:	
	SplitTcpSink(Acker*);
	int command(int argc, const char*const* argv);
	Agent *forwarder_;
protected:
	virtual void recvBytes(int nbytes);
};

// Implementation
//
SplitTcpSink::SplitTcpSink(Acker* acker) :
	DelAckSink(acker),
	forwarder_(0)
{
	bind("forwarder_", (TclObject **)(&forwarder_));
}

int SplitTcpSink::command(int argc, const char*const* argv) {
	if (argc == 3) {
		if (strcmp(argv[1], "forwarder") == 0) {
			forwarder_=(Agent *)TclObject::lookup(argv[2]);
			if (forwarder_ == 0) return TCL_ERROR;
			return TCL_OK;
		}
	}
	return (TcpSink::command(argc, argv));
}

void SplitTcpSink::recvBytes(int nbytes) {
	if (forwarder_) {
		if(nbytes > 0) {
			forwarder_->sendmsg(nbytes);
		}
	}
}



On Wed, Nov 14, 2001 at 04:02:53AM -0800, Khadijeh Fazaely wrote:
> Hi
> Do you find tcp split connections mechanism?
> If you find that please help me.
> Thanks for your help.
> 
> __________________________________________________
> Do You Yahoo!?
> Find the one for you at Yahoo! Personals
> http://personals.yahoo.com

-- 
Dimitris Velenis                              <[email protected]>
Network Management & Optimal Design Lab
National Technical University of Athens