Commit 26d3a7a9 authored by Pramod R Sanaga's avatar Pramod R Sanaga

1) Throughput is now being averaged over the last 100 samples ( or 500 ms).

2) Packet reordering on the forward path will be handled by UdpClient ( up to 10 packets of
reordering is allowed ).
3) Changes in Version-1 of UdpServer to reply to reordered forward path packets.
4) Updated DESIGN_RFC document to reflect the current design.
parent ce7eb23e
......@@ -100,7 +100,7 @@ Note: UDP packets sent by from nodeA may not always be the maximum sized packets
often the case with TCP. So, the minimum and maximum delay values need to be calculated ( ideally for
every packet size), keeping the maximum sized UDP packet in mind. The one way delay values are
thus scaled to represent maximum sized packets. ( we divide the one way delay by number of bytes in
the packet + overhead, and then multiply it by 1500 ).
the packet + overhead, and then multiply it by 1518 ).
Throughput:
-----------
......@@ -182,6 +182,27 @@ emulab environment and did not observe any increase in CPU usage when all the re
UDP packets were being dropped by the kernel ( due to full socket receive buffer ).
Handling reordering on the forward path:
----------------------------------------
RTT and DevRTT are calculated for the packets sent out, by using EWMA (similar to TCP)
for each received acknowledgement packet.
We consider a packet to be lost if
1) We did not receive an Ack for the packet and,
2) we received ACKs for 10 packets sent after it ( OR ) The current timestamp is greater
than the time at which the packet was sent + 10*( ewmaRTT + 4*ewmaDevRTT).
Note: The UdpServer application is not concerned with reordering and replies to all the packets that
it receives ( they can be out of order ). When an ACK has been received, UDP sensors detect
that the ACK corresponds to a reordered packet - if they have seen ACKs for packets which
had greater sequence numbers than this packet.
Averaging of throughput:
------------------------
Throughput is averaged over the last received 100 ACKs or ACKs received in the last 500ms.
The throughput value is a simple moving average. If any packet loss is detected, then the
value is reported as authoritative, else it is a tentative value.
......@@ -11,7 +11,10 @@ OBJECTS=${COMPILE_DIR}/UdpClient.o \
${COMPILE_DIR}/UdpThroughputSensor.o \
${COMPILE_DIR}/UdpPacketInfo.o \
${COMPILE_DIR}/UdpSensor.o \
${COMPILE_DIR}/UdpSensorList.o
${COMPILE_DIR}/UdpSensorList.o \
${COMPILE_DIR}/UdpRttSensor.o \
${COMPILE_DIR}/UdpLossSensor.o \
${COMPILE_DIR}/UdpAvgThroughputSensor.o
COMMON_INCLUDES=UdpLibs.h \
......@@ -23,6 +26,15 @@ ${EXECUTABLE}: ${OBJECTS}
${COMPILE_DIR}/UdpClient.o: UdpClient.cc UdpPacketSensor.h ${COMMON_INCLUDES}
${CC} -c ${CFLAGS} -o $@ $<
${COMPILE_DIR}/UdpAvgThroughputSensor.o: UdpAvgThroughputSensor.cc UdpAvgThroughputSensor.h ${COMMON_INCLUDES}
${CC} -c ${CFLAGS} -o $@ $<
${COMPILE_DIR}/UdpLossSensor.o: UdpLossSensor.cc UdpLossSensor.h ${COMMON_INCLUDES}
${CC} -c ${CFLAGS} -o $@ $<
${COMPILE_DIR}/UdpRttSensor.o: UdpRttSensor.cc UdpRttSensor.h ${COMMON_INCLUDES}
${CC} -c ${CFLAGS} -o $@ $<
${COMPILE_DIR}/UdpMinDelaySensor.o: UdpMinDelaySensor.cc UdpMinDelaySensor.h ${COMMON_INCLUDES}
${CC} -c ${CFLAGS} -o $@ $<
......
This diff is collapsed.
......@@ -28,17 +28,13 @@
#include "UdpMinDelaySensor.h"
#include "UdpMaxDelaySensor.h"
#include "UdpPacketSensor.h"
#include "UdpRttSensor.h"
#include "UdpLossSensor.h"
#include "UdpAvgThroughputSensor.h"
#include "UdpState.h"
#include "UdpSensorList.h"
pcap_t *pcapDescriptor = NULL;
UdpThroughputSensor *throughputSensor;
UdpMaxDelaySensor *maxDelaySensor;
UdpMinDelaySensor *minDelaySensor;
UdpPacketSensor *packetSensor;
char localIP[16] = "";
struct UdpState globalUdpState;
struct pcap_stat pcapStats;
int currentPcapLoss = 0;
......@@ -289,9 +285,13 @@ int main(int argc, char *argv[])
// Initialize the sensors.
sensorList = new UdpSensorList(logStream);
sensorList->addSensor(UDP_PACKET_SENSOR);
sensorList->addSensor(UDP_THROUGHPUT_SENSOR);
//sensorList->addSensor(UDP_THROUGHPUT_SENSOR);
sensorList->addSensor(UDP_MINDELAY_SENSOR);
sensorList->addSensor(UDP_MAXDELAY_SENSOR);
sensorList->addSensor(UDP_RTT_SENSOR);
sensorList->addSensor(UDP_LOSS_SENSOR);
sensorList->addSensor(UDP_AVG_THROUGHPUT_SENSOR);
// Initialize the libpcap filter.
int pcapFD = init_pcap(argv[1]);
......@@ -419,7 +419,13 @@ int main(int argc, char *argv[])
}
}
else
{
break;
}
}
logStream.close();
close(sd);
return 0;
}
......@@ -23,6 +23,13 @@ namespace globalConsts {
const static int minAckPacketSize = 2*USHORT_INT_SIZE + 2*ULONG_LONG_SIZE;
}
enum {UDP_PACKET_SENSOR, UDP_THROUGHPUT_SENSOR, UDP_MINDELAY_SENSOR, UDP_MAXDELAY_SENSOR};
enum {UDP_PACKET_SENSOR, UDP_THROUGHPUT_SENSOR, UDP_MINDELAY_SENSOR, UDP_MAXDELAY_SENSOR, UDP_RTT_SENSOR, UDP_LOSS_SENSOR, UDP_AVG_THROUGHPUT_SENSOR};
struct UdpAck {
unsigned long long timeTaken;
long packetSize;
};
#endif
......@@ -40,7 +40,7 @@ void UdpMaxDelaySensor::localAck(char *packetData, int Len,int overheadLen, unsi
bool eventFlag = false;
vector<UdpPacketInfo>::iterator vecIterator;
vecIterator = find_if(udpStateInfo.recentSentPackets.begin(), udpStateInfo.recentSentPackets.end(), bind2nd(equalSeqNum(), seqNum));
vecIterator = find_if(udpStateInfo.currentAckedPackets.begin(), udpStateInfo.currentAckedPackets.end(), bind2nd(equalSeqNum(), seqNum));
// Find the one way RTT for this packet.
......
......@@ -42,7 +42,7 @@ void UdpMinDelaySensor::localAck(char *packetData, int Len,int overheadLen, unsi
bool eventFlag = false;
vector<UdpPacketInfo >::iterator vecIterator;
vecIterator = find_if(udpStateInfo.recentSentPackets.begin(), udpStateInfo.recentSentPackets.end(), bind2nd(equalSeqNum(), seqNum));
vecIterator = find_if(udpStateInfo.currentAckedPackets.begin(), udpStateInfo.currentAckedPackets.end(), bind2nd(equalSeqNum(), seqNum));
// Calculate the one way delay as half of RTT.
......
......@@ -5,6 +5,7 @@ UdpPacketSensor::UdpPacketSensor(UdpState &udpStateVal, ofstream &logStreamVal)
lastSeenSeqNum(-1),
logStream(logStreamVal)
{
statReorderedPackets = 0;
}
......@@ -67,6 +68,10 @@ void UdpPacketSensor::localAck(char *packetData, int Len, int overheadLen, unsig
return;
}
// Remove the old state information.
udpStateInfo.currentAckedPackets.clear();
udpStateInfo.packetLoss = 0;
unsigned short int seqNum = *(unsigned short int *)(packetData + 1);
// Find the entry for the packet this ACK is acknowledging, and
......@@ -75,7 +80,9 @@ void UdpPacketSensor::localAck(char *packetData, int Len, int overheadLen, unsig
listIterator = find_if(sentPacketList.begin(), sentPacketList.end(), bind2nd(equalSeqNum(), seqNum));
if(listIterator == sentPacketList.end())
bool isReordered = handleReorderedAck(packetData, Len, overheadLen, timeStamp);
if( ( listIterator == sentPacketList.end() ) && ( isReordered == false ) )
{
logStream << "WARNING::Unknown seq number "<<seqNum<<" is being ACKed. "
"We might have received "
......@@ -94,9 +101,6 @@ void UdpPacketSensor::localAck(char *packetData, int Len, int overheadLen, unsig
udpStateInfo.isAckFake = false;
// Remove the old state information.
udpStateInfo.recentSentPackets.clear();
udpStateInfo.packetLoss = 0;
int i;
unsigned char numRedunAcksChar = 0;
......@@ -136,10 +140,34 @@ void UdpPacketSensor::localAck(char *packetData, int Len, int overheadLen, unsig
tmpPacketInfo.timeStamp = (*listIterator).timeStamp;
tmpPacketInfo.isFake = (*listIterator).isFake;
udpStateInfo.recentSentPackets.push_back(tmpPacketInfo);
udpStateInfo.currentAckedPackets.push_back(tmpPacketInfo);
sentPacketList.erase(listIterator);
}
else
{
// Check whether this ACK corresponds to a packet reordered
// on the forward path.
list<UdpPacketInfo >::iterator reOrderedPacketIterator ;
reOrderedPacketIterator = find_if(unAckedPacketList.begin(), unAckedPacketList.end(), bind2nd(equalSeqNum(), redunSeqNum));
// An unacked packet exists with this sequence number, delete it
// from the list and consider it acked.
if(reOrderedPacketIterator != unAckedPacketList.end())
{
tmpPacketInfo.seqNum = (*reOrderedPacketIterator).seqNum;
tmpPacketInfo.packetSize = (*reOrderedPacketIterator).packetSize;
tmpPacketInfo.timeStamp = (*reOrderedPacketIterator).timeStamp;
tmpPacketInfo.isFake = (*reOrderedPacketIterator).isFake;
udpStateInfo.currentAckedPackets.push_back(tmpPacketInfo);
unAckedPacketList.erase(reOrderedPacketIterator);
statReorderedPackets++;
logStream << "STAT:: Number of reordered packets = "<<statReorderedPackets<<endl;
}
}
}
}
......@@ -148,7 +176,7 @@ void UdpPacketSensor::localAck(char *packetData, int Len, int overheadLen, unsig
tmpPacketInfo.timeStamp = (*curPacketIterator).timeStamp;
tmpPacketInfo.isFake = (*curPacketIterator).isFake;
udpStateInfo.recentSentPackets.push_back(tmpPacketInfo);
udpStateInfo.currentAckedPackets.push_back(tmpPacketInfo);
// Check for packet loss - if we have any unacked packets with sequence
// numbers less than the received ACK seq number, then the packets/or their ACKS
......@@ -164,6 +192,15 @@ void UdpPacketSensor::localAck(char *packetData, int Len, int overheadLen, unsig
do{
logStream<<"STAT::Lost packet seqnum = "<<(*listIterator).seqNum<<endl;
// This packet might have been lost - but store it as UnAcked
// to account for reordering on the forward path.
tmpPacketInfo.seqNum = (*listIterator).seqNum;
tmpPacketInfo.packetSize = (*listIterator).packetSize;
tmpPacketInfo.timeStamp = (*listIterator).timeStamp;
tmpPacketInfo.isFake = (*listIterator).isFake;
unAckedPacketList.push_back(tmpPacketInfo);
sentPacketList.erase(listIterator);
listIterator = sentPacketList.end();
......@@ -179,3 +216,28 @@ void UdpPacketSensor::localAck(char *packetData, int Len, int overheadLen, unsig
sentPacketList.erase(curPacketIterator);
}
list<UdpPacketInfo>& UdpPacketSensor::getUnAckedPacketList()
{
return unAckedPacketList;
}
bool UdpPacketSensor::handleReorderedAck(char *packetData, int Len, int overheadLen, unsigned long long timeStamp)
{
list<UdpPacketInfo >::iterator listIterator;
unsigned short int seqNum = *(unsigned short int *)(packetData + 1);
bool retVal = false;
listIterator = find_if(unAckedPacketList.begin(), unAckedPacketList.end(), bind2nd(equalSeqNum(), seqNum));
if(listIterator == unAckedPacketList.end())
retVal = false;
else
{
retVal = true;
statReorderedPackets++;
logStream << "STAT:: Number of reordered packets = "<<statReorderedPackets<<endl;
}
return retVal;
}
......@@ -20,13 +20,18 @@ class UdpPacketSensor:public UdpSensor{
~UdpPacketSensor();
void localSend(char *packetData, int Len, int overheadLen, unsigned long long timeStamp);
void localAck(char *packetData, int Len,int overheadLen, unsigned long long timeStamp);
list<UdpPacketInfo>& getUnAckedPacketList();
private:
bool handleReorderedAck(char *packetData, int Len, int overheadLen, unsigned long long timeStamp);
list<UdpPacketInfo> sentPacketList;
list<UdpPacketInfo> unAckedPacketList;
UdpState & udpStateInfo;
long lastSeenSeqNum;
ofstream &logStream;
long statReorderedPackets;
};
......
......@@ -7,7 +7,10 @@ UdpSensorList::UdpSensorList(ofstream &logStreamVal)
depPacketSensor(NULL),
depThroughputSensor(NULL),
depMinDelaySensor(NULL),
depMaxDelaySensor(NULL)
depMaxDelaySensor(NULL),
depRttSensor(NULL),
depLossSensor(NULL),
depAvgThroughputSensor(NULL)
{
}
......@@ -31,6 +34,9 @@ UdpSensorList::~UdpSensorList()
delete depThroughputSensor;
delete depMinDelaySensor;
delete depMaxDelaySensor;
delete depRttSensor;
delete depLossSensor;
delete depAvgThroughputSensor;
}
void UdpSensorList::capturePacket(char *packetData, int Len, int overheadLen, unsigned long long timeStamp, int packetDirection)
......@@ -64,6 +70,14 @@ void UdpSensorList::addSensor(int sensorName)
case UDP_MAXDELAY_SENSOR:
addMaxDelaySensor();
break;
case UDP_RTT_SENSOR:
addRttSensor();
break;
case UDP_LOSS_SENSOR:
addLossSensor();
break;
case UDP_AVG_THROUGHPUT_SENSOR:
addAvgThroughputSensor();
default:
break;
......@@ -124,6 +138,7 @@ void UdpSensorList::addPacketSensor()
{
if(depPacketSensor == NULL)
{
//printf("Adding packet sensor\n");
depPacketSensor = new UdpPacketSensor(udpStateInfo, logStream);
pushSensor(depPacketSensor);
......@@ -136,6 +151,7 @@ void UdpSensorList::addThroughputSensor()
if(depThroughputSensor == NULL)
{
//printf("Adding throughput sensor\n");
depThroughputSensor = new UdpThroughputSensor(udpStateInfo, logStream);
pushSensor(depThroughputSensor);
......@@ -148,6 +164,7 @@ void UdpSensorList::addMinDelaySensor()
if(depMinDelaySensor == NULL)
{
//printf("Adding mindelay sensor\n");
depMinDelaySensor = new UdpMinDelaySensor(udpStateInfo, logStream);
pushSensor(depMinDelaySensor);
......@@ -162,8 +179,53 @@ void UdpSensorList::addMaxDelaySensor()
if(depMaxDelaySensor == NULL)
{
//printf("Adding maxdelay sensor\n");
depMaxDelaySensor = new UdpMaxDelaySensor(udpStateInfo, logStream);
pushSensor(depMaxDelaySensor);
}
}
void UdpSensorList::addRttSensor()
{
addPacketSensor();
if(depRttSensor == NULL)
{
//printf("Adding rtt sensor\n");
depRttSensor = new UdpRttSensor(udpStateInfo, logStream);
pushSensor(depRttSensor);
}
}
void UdpSensorList::addLossSensor()
{
addPacketSensor();
addRttSensor();
if(depLossSensor == NULL)
{
//printf("Adding loss sensor\n");
depLossSensor = new UdpLossSensor(depPacketSensor, depRttSensor,udpStateInfo, logStream);
pushSensor(depLossSensor);
}
}
void UdpSensorList::addAvgThroughputSensor()
{
addLossSensor();
if(depAvgThroughputSensor == NULL)
{
//printf("Adding avgThroughput sensor\n");
depAvgThroughputSensor = new UdpAvgThroughputSensor(depLossSensor, udpStateInfo, logStream);
pushSensor(depAvgThroughputSensor);
}
}
......@@ -6,12 +6,18 @@
#include "UdpThroughputSensor.h"
#include "UdpMinDelaySensor.h"
#include "UdpMaxDelaySensor.h"
#include "UdpRttSensor.h"
#include "UdpLossSensor.h"
#include "UdpAvgThroughputSensor.h"
class UdpSensor;
class UdpPacketSensor;
class UdpThroughputSensor;
class UdpMinDelaySensor;
class UdpMaxDelaySensor;
class UdpRttSensor;
class UdpLossSensor;
class UdpAvgThroughputSensor;
class UdpSensorList {
public:
......@@ -29,6 +35,9 @@ class UdpSensorList {
void addThroughputSensor();
void addMinDelaySensor();
void addMaxDelaySensor();
void addRttSensor();
void addLossSensor();
void addAvgThroughputSensor();
UdpSensor *sensorListHead;
UdpSensor *sensorListTail;
......@@ -36,10 +45,13 @@ class UdpSensorList {
UdpState udpStateInfo;
ofstream &logStream;
UdpSensor *depPacketSensor;
UdpSensor *depThroughputSensor;
UdpSensor *depMinDelaySensor;
UdpSensor *depMaxDelaySensor;
UdpPacketSensor *depPacketSensor;
UdpThroughputSensor *depThroughputSensor;
UdpMinDelaySensor *depMinDelaySensor;
UdpMaxDelaySensor *depMaxDelaySensor;
UdpRttSensor *depRttSensor;
UdpLossSensor *depLossSensor;
UdpAvgThroughputSensor *depAvgThroughputSensor;
};
......
......@@ -12,7 +12,7 @@ class UdpState{
public:
// vector of info about packets sent from this host,
// sequence number, timestamp & size of the packet.
vector< UdpPacketInfo > recentSentPackets;
vector< UdpPacketInfo > currentAckedPackets;
// Indicates the number of packets lost -
// updated whenever an ACK is received.
......@@ -54,7 +54,7 @@ class UdpState{
~UdpState()
{
// Remove any packets stored in the vector.
recentSentPackets.clear();
currentAckedPackets.clear();
}
};
......
......@@ -56,10 +56,12 @@ void UdpThroughputSensor::localAck(char *packetData, int Len,int overheadLen, un
unsigned short int seqNum = *(unsigned int *)(packetData + 1);
unsigned short int echoedPacketSize = *(unsigned short int *)(packetData + 1 + globalConsts::USHORT_INT_SIZE);
unsigned long long ackTimeDiff = currentAckTimeStamp - lastAckTime;
unsigned long long timeDiff = 0;
unsigned long long ackTimeDiff = (currentAckTimeStamp - lastAckTime);
vector<UdpPacketInfo>::iterator vecIterator;
unsigned long long timeDiff = 0;
// Average the throughput over all the packets being acknowledged.
if(numRedunAcks > 0)
{
......@@ -73,9 +75,9 @@ void UdpThroughputSensor::localAck(char *packetData, int Len,int overheadLen, un
redunPacketSize = *(unsigned short int *)(packetData + 1 + globalConsts::minAckPacketSize + i*globalConsts::redunAckSize + globalConsts::USHORT_INT_SIZE);
// Find if this redundant ACK is useful - or it was acked before.
vecIterator = find_if(udpStateInfo.recentSentPackets.begin(), udpStateInfo.recentSentPackets.end(), bind2nd(equalSeqNum(), redunSeqNum));
vecIterator = find_if(udpStateInfo.currentAckedPackets.begin(), udpStateInfo.currentAckedPackets.end(), bind2nd(equalSeqNum(), redunSeqNum));
if(vecIterator != udpStateInfo.recentSentPackets.end())
if(vecIterator != udpStateInfo.currentAckedPackets.end())
{
// Calculate throughput for the packet being acked by
// the redundant ACK.
......@@ -96,8 +98,10 @@ void UdpThroughputSensor::localAck(char *packetData, int Len,int overheadLen, un
}
}
if(ackTimeDiff == 0)
return;
// Calculate the throughput for the current packet being ACKed.
vecIterator = find_if(udpStateInfo.recentSentPackets.begin(), udpStateInfo.recentSentPackets.end(), bind2nd(equalSeqNum(), seqNum));
vecIterator = find_if(udpStateInfo.currentAckedPackets.begin(), udpStateInfo.currentAckedPackets.end(), bind2nd(equalSeqNum(), seqNum));
// We lost the record of the size of this packet due to libpcap
// loss, use the length echoed back in the ACK.
......@@ -117,14 +121,14 @@ void UdpThroughputSensor::localAck(char *packetData, int Len,int overheadLen, un
logStream << "VALUE::Tentative bandwidth for seqNum = "<<seqNum<<", value = "<< throughputKbps <<"acktimeDiff = "<<ackTimeDiff<<"\n";
logStream << "TPUT:TIME="<<timeStamp<<",TENTATIVE="<<throughputKbps<<endl;
logStream << "LOSS:TIME="<<timeStamp<<",LOSS=0"<<endl;
// logStream << "LOSS:TIME="<<timeStamp<<",LOSS=0"<<endl;
}
else
{
// Send this as the authoritative available bandwidth value.
logStream << "VALUE::Authoritative bandwidth for seqNum = "<<seqNum<<", value = "<< throughputKbps <<"ackTimeDiff = "<<ackTimeDiff<<"\n";
logStream << "TPUT:TIME="<<timeStamp<<",AUTHORITATIVE="<<throughputKbps<<endl;
logStream << "LOSS:TIME="<<timeStamp<<",LOSS="<<udpStateInfo.packetLoss<<endl;
// logStream << "LOSS:TIME="<<timeStamp<<",LOSS="<<udpStateInfo.packetLoss<<endl;
}
// Save the receiver timestamp of this ACK packet, so that we can
......
......@@ -16,7 +16,7 @@ class UdpThroughputSensor:public UdpSensor{
void localAck(char *packetData, int Len,int overheadLen, unsigned long long timeStamp);
private:
unsigned long long lastAckTime;
unsigned long long lastAckTime, lastRecvAckTime;
double throughputKbps;
UdpState &udpStateInfo;
ofstream &logStream;
......
......@@ -7,6 +7,7 @@ inFile = open(sys.argv[1], 'r')
bandwidthFile = "AvailBandwidth.log"
throughputFile = "Throughput.log"
avgThroughputFile = "AvgThroughput.log"
lossFile = "Loss.log"
minDelayFile = "MinDelay.log"
maxDelayFile = "MaxDelay.log"
......@@ -19,6 +20,7 @@ messageFile = "Messages.log"
# with GnuPlot.
outFileBandwidth = open(bandwidthFile, 'w')
outFileThroughput = open(throughputFile, 'w')
outFileAvgThroughput = open(avgThroughputFile, 'w')
outFileLoss = open(lossFile, 'w')
outFileMinD = open(minDelayFile, 'w')
outFileMaxD = open(maxDelayFile, 'w')
......@@ -34,9 +36,10 @@ throughputBps = 0
# Array indices, 0 - throughput, 1 - loss, 2 - minimum delay, 3 - queue size
# 4 - deviation in send times, 5 - actual queuing delay per packet
initTimeArray = [0,0,0,0,0,0]
timeDiffArray = [0,0,0,0,0,0]
initFlagsArray = [0,0,0,0,0,0]
# 6 - average throughput
initTimeArray = [0,0,0,0,0,0,0]
timeDiffArray = [0,0,0,0,0,0,0]
initFlagsArray = [0,0,0,0,0,0,0]
for line in inFile:
match = regExp.match(line)
......@@ -109,6 +112,24 @@ for line in inFile:
timeDiffArray[5] = int(match.group(3)) - initTimeArray[5]
outFileQueueD.write(str(timeDiffArray[5]) + " " + match.group(5) + "\n" )
elif match.group(1) == 'AVGTPUT':
if initFlagsArray[6] == 0:
initTimeArray[6] = int(match.group(3))
timeDiffArray[6] = 0
initFlagsArray[6] = 1
else:
timeDiffArray[6] = int(match.group(3)) - initTimeArray[6]
if match.group(4) == 'AUTHORITATIVE':
availBandwidth = float(match.group(5))
elif match.group(4) == 'TENTATIVE':
if float(match.group(5)) > availBandwidth:
availBandwidth = float(match.group(5))
bandWidthBps = 1024*availBandwidth / ( 8 )
outFileAvgThroughput.write(str(timeDiffArray[6]) + " " + str(bandWidthBps) + "\n" )
else:
outFileMessages.write(line)
......
......@@ -2,17 +2,16 @@
# Command line arguments:
# First argument - Interface on which we are connected to the server node ( not the control conn ).
# Second - Local IP address on the above interface.
# Third - Address/hostname of the node running the server program.
# Four - Number of UDP packets to send to the server.
# Five - Size of the data part of the UDP packets.
# Six - The rate at which the packets should be sent ( bits per sec )
# Second - Address/hostname of the node running the server program.
# Third - Number of UDP packets to send to the server.
# Fourth - Size of the data part of the UDP packets.
# Fifth - The rate at which the packets should be sent ( bits per sec )
# This rate will also include the UDP, IP & ethernet headers along with the packet size.
# Seven - MHz of CPU clock frequency
# Sixth - MHz of CPU clock frequency
# The client runs in an infinite while loop - so when no more data is being printed on
# screen, it is safe to kill it( Ctrl-C) and look at the results.
# NOTE: The UdpServer needs to be restarted before running the client for a second time.
sudo ./UdpClient eth1 node2 4000 1470 1350000 852
sudo ./UdpClient eth0 node1 10000 1470 500000 601
This diff is collapsed.
......@@ -127,7 +127,7 @@ void handleUDP_Version_1(struct pcap_pkthdr const *pcap_info, struct udphdr cons
// packet - it arrived out of order.
// TODO:Take wrap around into account.
if(packetSeqNum > curSeqNum)
// if(packetSeqNum > curSeqNum)
{
if(packetSeqNum > (curSeqNum + 1))
{
......@@ -259,6 +259,11 @@ void handleUDP_Version_1(struct pcap_pkthdr const *pcap_info, struct udphdr cons
// Send the ACK off to the host we received the data packet from.
sendto(sd,appAck,ackLength,flags,(struct sockaddr *)&cliAddr,cliLen), errno;
}
// else // This packet might be a re-ordered packet.
{
// printf("Received reordered packet = %d\n", packetSeqNum);
}
}
void handleUDP_Version_2(struct pcap_pkthdr const *pcap_info, struct udphdr const *udpHdr, u_char *const udpPacketStart, struct ip const *ipPacket)
......
......@@ -13,4 +13,4 @@
# The server runs in an infinite while loop - it can be terminated after the session
# is determined to be done at the client - kill using Ctrl-C.
sudo ./UdpServer eth1
sudo ./UdpServer eth0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment