Skip to content

Commit

Permalink
Fixed Parsing problem, using string regex
Browse files Browse the repository at this point in the history
  • Loading branch information
ntn16104 committed Feb 21, 2021
1 parent 54559c0 commit 3865bf7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions pserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def runSimulation(input1):
attackerType = float(Param[22]);
amplification = float(Param[23]);


response = main.runSimulation(ddd_state, skip_sim, sumOut, logOut, packet_size,rtsa,max_queue_size,ddd_mapping_delay,propagation_delay,number_of_ddd_ports, time_to_next_ddd_port,overlap_time_old_ddd, durationSim, numbSynAckResends, clienttoRouter, routertoClient,routertoReflector,routertoNormal,normaltoRouter,reflectortoRouter,attackertoReflector, queueLimit, attackerType, amplification)

print('Backend Simulation Total Elapsed Time:', time.time() - start_time, 'seconds')

# Converting response data structure into json string
Expand Down
60 changes: 30 additions & 30 deletions templates/temp_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ <h3 class="text-white-50 mx-auto mt-2 mb-5">This is a simulation project, implem
//alert(content);

//document.getElementById("output").innerHTML= content;
var contents= content.split(" ");
var contents= content.split(/\s+/);

//packets = new Number(contents[0]);
//ddd = contents[1];
Expand All @@ -395,35 +395,35 @@ <h3 class="text-white-50 mx-auto mt-2 mb-5">This is a simulation project, implem
//skipsim = contents[4];
//outFile = contents[5];

// Ignore up to index 23.


packetsize = new Number(contents[24]);
rtsa = new Number(contents[25]);
maxqueuesize = new Number(contents[26]);
dddmappingdelay = new Number(contents[27]);
propagationdelay = new Number(contents[28]);
numofDDDport = new Number(contents[29]);
timetonextDDDport = new Number(contents[30]);
overlaptimeoldDDD = new Number(contents[31]);
durationSim = new Number(contents[32]);
numbSynAckResends = new Number(contents[33]);
clienttoRouter = new Number(contents[34]);
routertoClient = new Number(contents[35]);
routertoReflector = new Number(contents[36]);
routertoNormal = new Number(contents[37]);
normaltoRouter= new Number(contents[38]);
reflectortoRouter= new Number(contents[39]);
attackertoReflector= new Number(contents[40]);
queueLimit= new Number(contents[41]);
DDDstate = contents[42]; // booleans
attackerType = new Number(contents[43]);
amplification = new Number(contents[44]);


skipsim = contents[45]; // booleans
logfile = contents[46]; // booleans
summfile = contents[47]; // booleans

//console.log(contents[22]);

packetsize = new Number(contents[1]);
rtsa = new Number(contents[2]);
maxqueuesize = new Number(contents[3]);
dddmappingdelay = new Number(contents[4]);
propagationdelay = new Number(contents[5]);
numofDDDport = new Number(contents[6]);
timetonextDDDport = new Number(contents[7]);
overlaptimeoldDDD = new Number(contents[8]);
durationSim = new Number(contents[9]);
numbSynAckResends = new Number(contents[10]);
clienttoRouter = new Number(contents[11]);
routertoClient = new Number(contents[12]);
routertoReflector = new Number(contents[13]);
routertoNormal = new Number(contents[14]);
normaltoRouter= new Number(contents[15]);
reflectortoRouter= new Number(contents[16]);
attackertoReflector= new Number(contents[17]);
queueLimit= new Number(contents[18]);
DDDstate = contents[19]; // booleans
attackerType = new Number(contents[20]);
amplification = new Number(contents[21]);

skipsim = contents[22]; // booleans
logfile = contents[23]; // booleans
summfile = contents[24]; // booleans


console.log(packetsize);
console.log("The content is " + DDDstate);
Expand Down

0 comments on commit 3865bf7

Please sign in to comment.