OMNeT++ BITTORRENT Simulation

BITTORRENT is as peer to peer content distribution system which consists a  set of network protocols for effective communication between entities.OMNeT++ Bittorrent utilizes bartering scheme for reducing parasitic behavior for free-riding.100% success rate for simulating OMNET++ Bittorrent Projects.

Primary goal of  OMNET++ Bittorrent implementation plan is to establish a realistic simulation environment that will incorporate important protocol stack features ranging from the application logic to the underlying network topology.

OMNeT++ Bittorrent Simulation

Modeling aspects of bittorent:

  • Download and upload rates.
  • Peer arrival process.
  • Efficiency of resource sharing.
  • Dynamic population mode.
  • Number of permanent seeds.

Characteristics of bittorent:

  • Peer Selection is based on system which is willing to share back files.
  • Avoid delay from blocking last protocol request from all peers.
  • Piece selection is about diversity.
  • Avoids Bottleneck of central distribution problem through distribute consumption of resources.
  • Avoid Performance from deterioration.
  • Omnet++ Bittorrent used to avoid boostraping problem through tit for tat selection which ensure peer to join swarm.

 

Omnet++ Bittorrent Architecture

Download Sample Source Code for OMNeT++ BITTORRENT


void AODVRouting::delayDatagram(IPv4Datagram *datagram)
{
    EV_DETAIL << "Queuing datagram, source " << datagram->getSrcAddress() << ", destination " << datagram->getDestAddress() << endl; const IPv4Address& target = datagram->getDestAddress();
    targetAddressToDelayedPackets.insert(std::pair<IPv4Address, IPv4Datagram *>(target, datagram));
}
void AODVRouting::sendRREQ(AODVRREQ *rreq, const IPv4Address& destAddr, unsigned int timeToLive)
{    
    std::map<IPv4Address, WaitForRREP *>::iterator rrepTimer = waitForRREPTimers.find(rreq->getDestAddr());
    WaitForRREP *rrepTimerMsg = NULL;
    if (rrepTimer != waitForRREPTimers.end()) {
        rrepTimerMsg = rrepTimer->second;
        unsigned int lastTTL = rrepTimerMsg->getLastTTL();
        rrepTimerMsg->setDestAddr(rreq->getDestAddr());
        if (timeToLive != 0) {
            rrepTimerMsg->setLastTTL(timeToLive);
            rrepTimerMsg->setFromInvalidEntry(true);
            cancelEvent(rrepTimerMsg);
        }
        else if (lastTTL + ttlIncrement < ttlThreshold) { ASSERT(!rrepTimerMsg->isScheduled());
            timeToLive = lastTTL + ttlIncrement;
            rrepTimerMsg->setLastTTL(lastTTL + ttlIncrement);
        }
        else {
            ASSERT(!rrepTimerMsg->isScheduled());
            timeToLive = netDiameter;
            rrepTimerMsg->setLastTTL(netDiameter);
        }
    }
    else {
        rrepTimerMsg = new WaitForRREP();
        waitForRREPTimers[rreq->getDestAddr()] = rrepTimerMsg;
        ASSERT(hasOngoingRouteDiscovery(rreq->getDestAddr()));
        timeToLive = ttlStart;
        rrepTimerMsg->setLastTTL(ttlStart);
        rrepTimerMsg->setFromInvalidEntry(false);
        rrepTimerMsg->setDestAddr(rreq->getDestAddr());    }
    // Each time, the timeout for receiving a RREP is RING_TRAVERSAL_TIME.
    simtime_t ringTraversalTime = 2.0 * nodeTraversalTime * (timeToLive + timeoutBuffer);
    scheduleAt(simTime() + ringTraversalTime, rrepTimerMsg);
    EV_INFO << "Sending a Route Request with target " << rreq->getDestAddr() << " and TTL= " << timeToLive << endl; sendAODVPacket(rreq, destAddr, timeToLive, jitterPar->doubleValue());
    rreqCount++;
}