SlideShare a Scribd company logo
1 of 4
Download to read offline
Programming Project Design Report (CS 6390.001)
Group Members- Abhishek Datta (axd151630), Raj Gupta(rxg164730)
Implementation at network-level:
a> Functionality of a Fog Topology/distributed system including a bunch of nodes, interacting with each other to
provide relevant cloud services (like computation, networking and storage to IoT devices at lower level) thereby
considerably reducing the response-time delay incurred in IoT device-requests processed by the cloud.
Operation of fog-node roughly includes 2 specific tasks –
1> Receive request packets from IoT devices at UDP port, and either processing or forwarding to neighbouring
nodes on TCP connections based on max response-time limit;
2> Periodic exchange of current queuing-time information with 1-hop neighbours so that each node can decide
its best neighbour to forward the packet.
b> Simulation of the cloud-node functionality in the form of an independent thread implementation having a
considerably long enough queue, that can process any request that is forwarded towards it. Request packets can
be forwarded by any fog-node (in case maximum forward-limit of a packet reached) over TCP connections
established between individual fog-nodes and the cloud.
c> For debugging and testing purposes, the response packet received by the IoT device from the fog/cloud
should have the complete information of its own path traced across several fog-nodes before being accepted
and processed by any node. On receipt of any packet, the IoT device should be able to print (in plain text) from
the message body, a consolidated information of all the fog nodes visited and activity performed at each node on
the request packet until it is processed.
Assumptions considered during implementation:
1. A working model of IoT node implementation should be available beforehand, that continuously generates
request packets in specified format and randomly forwards to the fog-nodes.
The request-packet message body should follow the pre-decided format below: -
Packet sequence-number
Request-type
Forward Limit
IP-address of the request generator
UDP port-number of request generator
2. The IoT device request-generator should have prior knowledge on the IP-address/UDP port information for
each of the fog-nodes that it receives as input in the beginning.
3. The connection between IoT node and each fog-node should run on UDP (connectionless) socket
implementation. On the other hand, all fog-nodes should interact among themselves and with the cloud-node
over TCP sockets.
4. It can be inferred from the description that, a Request-type of x (should be a numerical value included in the
message body of any packet) should be implied as the processing time of x units (in secs). No further calculation is
needed to derive processing delay of any new packet.
5. The Maximum Response-time for any fog-node exceeding which a node must forward packets to the next best
neighbour/cloud, should be entered as an input parameter while running a fog-node on terminal with below
command: FogNode Max_Response_Time t MY_IP MY_UDP MY_TCP N1 TCP1 N2 TCP2...
6. The forward limit for each request packet obtained from the message body of the corresponding packet,
should be the decided max hop-limit after which an unprocessed request should be forwarded to the cloud.
Code-level implementation:
Implementation of fog-node/cloud functionality will be done in C/Java programming language at all levels.
TCP/UDP listener sockets (for receiving packets) and worker sockets (for processing per request-packet in a fog-
node) will be implemented as multiple threads in Java.
Another higher level of multi-threading will be implemented while designing active fog-nodes that can parallelly
process request-messages randomly posted by the IoT request generator. The active threads (representing fog-
nodes) will be maintained in a thread pool (i.e. the fog topology) which can act on any number of request-packets
periodically generated by the IoT devices.
Generic Approach and Understanding:
Packet forwarded over TCP connection to cloud-node in case Forward limit reached at R1 or R2 or R3 etc
UDP
UDP packet 2 UDP packet 4
UDP packet 1 UDP packet 3
1> All fog-nodes in the topology, run on the terminal with below command:
FogNode Max_Response_Time t MY_IP MY_UDP MY_TCP N1 TCP1 N2 TCP2...
2> IoT request generator receives input IP/UDP port information from the fog-nodes (declared in the
terminal), and runs below command in terminal:
IoTreqGen interval IP1 UDP1 IP2 UDP2...
3> Fog-nodes begin exchanging periodic updates on current queueing time delay with its 1-hop neighbours (as
specified in the terminal command run for each node i.e. N1, N2 etc) after every t secs (passed as an input
argument in the terminal command).
Fog-nodes interact over TCP sockets establishing connections among nodes, where one in a pair acts as a ser
-ver socket and listens on the TCP port identified in terminal command and the other acts as a client socket,
sending update. Initially queueing time for each node calculates as 0
4> Each fog-node listens for incoming request messages on its UDP port (as identified in terminal command).
Cloud node
Periodic TCP
updates (t secs)
Periodic TCP
updates (t secs)
On receipt of any new message Rnew from IoT request generator, the listener socket calculates its response
time (Queueing delay of all currently queued messages + Processing time for Rnew, as derived from request-
type) and compares with Max response-time (passed as an argument in terminal command of the node).
Timer function is called and checked for t seconds since last periodic update; in such case repeat step 3 again.
5> In case of response-time for Rnew < Max Response-time, it adds the new request to end of the processing
queue.
Otherwise, the request packet is forwarded to next best neighbour with least queueing time (based on
last periodic queueing-time update exchanged between 1-hop neighbours) thereby decrementing the
Forward Limit field in the message body. Care should be taken, not to re-forward to the best neighbour from
which the packet has been received, in which case it should be forwarded to the 2nd
best neighbour in the list.
Timer function is called and checked for t seconds since last periodic update; in such case repeat step 3 again.
6> In case Forward-Limit equals 0 while decrementing, it forwards the request packet towards the cloud-node
over TCP connection to the fixed-IP address/ TCP port defined for the cloud.
Also in step 5 if there is no best neighbour left in the periodic update list of the fog-node, it directly sends the
packet towards the cloud-node. Therefore, cloud is always the last priority in the periodic update list for any
fog-node.
Timer function is called and checked for t seconds since last periodic update; in such case repeat step 3 again.
7> In case the fog-node is unable to process the request-packet due to exceeding Max response-time of that
node, it appends a short information text at the end of the text-string within the message body and
propagates towards the next best neighbour. Continuing the process at each hop until the packet is processed,
a complete overview of the visited fog-nodes and activities performed by each node is printed when the
response packet arrives back at the IoT device.
For debugging reasons, below information per fog-node is enough to track the packet flow:
FogNode ID, Response-time calculated, Next Best neighbour, Neighbour’s queue-time update
Handing the looping problem:
Let suppose, the periodic TCP queueing update messages among the fog-node R2’s 1-hop neighbours creates a
best-neighbour decision table in below format:
Fog-node IP Fog-node TCP port Neighbour IP Neighbour Port Queueing time(secs)
R2 (192.x.x.x) 1000 R1 (192.y.y.y) 2000 25
R2(192.x.x.x) 1000 R3 (192.y.y.z) 3000 20
R2(192.x.x.x) 1000 R4 (192.y.y.x) 4000 15
R2(192.x.x.x) 1000 Cloud (10.0.0.1) 8080 Infinity
Case 1:
According to the above table, R2 should decide its best-hop neighbour as R4 as queueing delay is least (15 secs)
for R4 fog-node. In such cases, when the request packet has arrived from a fog-node to R2 which is later decided
as the best 1-hop neighbour, R2 should offload the packet to the 2nd
best neighbour R3 (with next best queueing
time 20 secs) to avoid looping problem among R2 and R4.
Queueing delay = 25 Max response-time reached Queueing delay = 20
Request packet forwarded by 4
Queueing delay = 15
1 2 3
4
Case 2 (leaf node):
According to the above table, R2 should decide its best-hop neighbour as R4 as queueing delay is least (15 secs)
for R4 fog-node. In this case, when the request packet has arrived from a fog-node (R4) to R2 which is later
calculated as the best 1-hop neighbour for R2, it should offload the packet to the 2nd
best neighbour R2 (with next
best queueing time 20 secs) to avoid looping problem among R2 and R4.
If R1 also has its max response-time exceeded, it has no other neighbour to forward to since R2 has already
offloaded the packet towards R1. In such cases, it should directly send the packet to cloud-node Ip address/port
number defined.
Cloud
Packet forwarded by 2
Queueing delay = 20 Max response-time reached Queueing delay = 25
Request packet forwarded by 4
Queueing delay = 15
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 2 3
4

More Related Content

What's hot

Lec 12(Transport Layer)
Lec 12(Transport Layer)Lec 12(Transport Layer)
Lec 12(Transport Layer)maamir farooq
 
TCP - Transmission Control Protocol
TCP - Transmission Control ProtocolTCP - Transmission Control Protocol
TCP - Transmission Control ProtocolPeter R. Egli
 
Transport layer services
Transport layer servicesTransport layer services
Transport layer servicesMelvin Cabatuan
 
Lec 2(intoduction of computer networkes)
Lec 2(intoduction of computer networkes)Lec 2(intoduction of computer networkes)
Lec 2(intoduction of computer networkes)maamir farooq
 
Computer network (Lecture 2)
Computer network (Lecture 2)Computer network (Lecture 2)
Computer network (Lecture 2)Vishwajit Nandi
 
Chapter 6 - The Link Layer: Links, Access Networks and LANs
Chapter 6 - The Link Layer: Links, Access Networks and LANsChapter 6 - The Link Layer: Links, Access Networks and LANs
Chapter 6 - The Link Layer: Links, Access Networks and LANsAndy Juan Sarango Veliz
 
Tcp Ip Overview
Tcp Ip OverviewTcp Ip Overview
Tcp Ip OverviewAmir Malik
 
TCP/IP 3-way Handshake
TCP/IP 3-way Handshake TCP/IP 3-way Handshake
TCP/IP 3-way Handshake Alok Tripathi
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocolIshtdeep Hora
 
Chapter03 sg
Chapter03 sgChapter03 sg
Chapter03 sgDang Hop
 
Chapter 3. sensors in the network domain
Chapter 3. sensors in the network domainChapter 3. sensors in the network domain
Chapter 3. sensors in the network domainPhu Nguyen
 
Bh us-02-kaminsky-blackops
Bh us-02-kaminsky-blackopsBh us-02-kaminsky-blackops
Bh us-02-kaminsky-blackopsDan Kaminsky
 
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDPFaster packet processing in Linux: XDP
Faster packet processing in Linux: XDPDaniel T. Lee
 

What's hot (20)

Lec 12(Transport Layer)
Lec 12(Transport Layer)Lec 12(Transport Layer)
Lec 12(Transport Layer)
 
TCP - Transmission Control Protocol
TCP - Transmission Control ProtocolTCP - Transmission Control Protocol
TCP - Transmission Control Protocol
 
Transport layer services
Transport layer servicesTransport layer services
Transport layer services
 
Lec 2(intoduction of computer networkes)
Lec 2(intoduction of computer networkes)Lec 2(intoduction of computer networkes)
Lec 2(intoduction of computer networkes)
 
Np unit iv ii
Np unit iv iiNp unit iv ii
Np unit iv ii
 
Computer network (Lecture 2)
Computer network (Lecture 2)Computer network (Lecture 2)
Computer network (Lecture 2)
 
Chapter 6 - The Link Layer: Links, Access Networks and LANs
Chapter 6 - The Link Layer: Links, Access Networks and LANsChapter 6 - The Link Layer: Links, Access Networks and LANs
Chapter 6 - The Link Layer: Links, Access Networks and LANs
 
Tcp Ip Overview
Tcp Ip OverviewTcp Ip Overview
Tcp Ip Overview
 
Chapter 9 - Multimedia Networking
Chapter 9 - Multimedia NetworkingChapter 9 - Multimedia Networking
Chapter 9 - Multimedia Networking
 
Part 7 : HTTP/2, UDP and TCP
Part 7 : HTTP/2, UDP and TCPPart 7 : HTTP/2, UDP and TCP
Part 7 : HTTP/2, UDP and TCP
 
Np unit1
Np unit1Np unit1
Np unit1
 
TCP/IP 3-way Handshake
TCP/IP 3-way Handshake TCP/IP 3-way Handshake
TCP/IP 3-way Handshake
 
Rtp
RtpRtp
Rtp
 
Understanding TCP and HTTP
Understanding TCP and HTTP Understanding TCP and HTTP
Understanding TCP and HTTP
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocol
 
Chapter03 sg
Chapter03 sgChapter03 sg
Chapter03 sg
 
Chapter 3. sensors in the network domain
Chapter 3. sensors in the network domainChapter 3. sensors in the network domain
Chapter 3. sensors in the network domain
 
Osi model
Osi modelOsi model
Osi model
 
Bh us-02-kaminsky-blackops
Bh us-02-kaminsky-blackopsBh us-02-kaminsky-blackops
Bh us-02-kaminsky-blackops
 
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDPFaster packet processing in Linux: XDP
Faster packet processing in Linux: XDP
 

Viewers also liked

Dadosverbospasado presente-futuro-150126140634-conversion-gate01 copia
Dadosverbospasado presente-futuro-150126140634-conversion-gate01 copiaDadosverbospasado presente-futuro-150126140634-conversion-gate01 copia
Dadosverbospasado presente-futuro-150126140634-conversion-gate01 copiaHardy Pennekamp
 
산악회『LG777』.『XYZ』워크샵장소추천
산악회『LG777』.『XYZ』워크샵장소추천산악회『LG777』.『XYZ』워크샵장소추천
산악회『LG777』.『XYZ』워크샵장소추천hydkfuig
 
Sesión 5 de 5 filosofía de la educación
Sesión 5 de 5 filosofía de la educación Sesión 5 de 5 filosofía de la educación
Sesión 5 de 5 filosofía de la educación USET
 
Projected budgeting FHC A'COSTA RICA'C
Projected budgeting FHC A'COSTA RICA'CProjected budgeting FHC A'COSTA RICA'C
Projected budgeting FHC A'COSTA RICA'CFabrice CLAMAGIRAND
 
Financial triannual evolution FHC CHINA ASIA
Financial triannual evolution FHC CHINA ASIAFinancial triannual evolution FHC CHINA ASIA
Financial triannual evolution FHC CHINA ASIAFabrice CLAMAGIRAND
 
final presentation of my INTERN
final presentation of my INTERNfinal presentation of my INTERN
final presentation of my INTERNShahina Supriti
 
Project report software major project
Project report software major projectProject report software major project
Project report software major projectAnnurajsingh
 
SOFTWARE PROJECT MANAGEMENT TOOL Project Report
SOFTWARE PROJECT MANAGEMENT TOOL Project ReportSOFTWARE PROJECT MANAGEMENT TOOL Project Report
SOFTWARE PROJECT MANAGEMENT TOOL Project ReportSai Charan
 
Final Internship Report
Final Internship ReportFinal Internship Report
Final Internship ReportMinhas Kamal
 
Online Student Registration System
Online Student Registration SystemOnline Student Registration System
Online Student Registration SystemSanjana Agarwal
 
Online shopping Report
Online shopping ReportOnline shopping Report
Online shopping ReportPragnya Dash
 
SRS for online examination system
SRS for online examination systemSRS for online examination system
SRS for online examination systemlunarrain
 
JUSTCABS - an Online Cab Reservation System (Final Year Project)
JUSTCABS - an Online Cab Reservation System (Final Year Project)JUSTCABS - an Online Cab Reservation System (Final Year Project)
JUSTCABS - an Online Cab Reservation System (Final Year Project)Amartya .
 
Internship Final Report
Internship Final Report Internship Final Report
Internship Final Report Nadia Nahar
 
Online Voting System Project File
Online Voting System Project FileOnline Voting System Project File
Online Voting System Project FileNitin Bhasin
 

Viewers also liked (18)

Dadosverbospasado presente-futuro-150126140634-conversion-gate01 copia
Dadosverbospasado presente-futuro-150126140634-conversion-gate01 copiaDadosverbospasado presente-futuro-150126140634-conversion-gate01 copia
Dadosverbospasado presente-futuro-150126140634-conversion-gate01 copia
 
산악회『LG777』.『XYZ』워크샵장소추천
산악회『LG777』.『XYZ』워크샵장소추천산악회『LG777』.『XYZ』워크샵장소추천
산악회『LG777』.『XYZ』워크샵장소추천
 
PID1063629
PID1063629PID1063629
PID1063629
 
Sesión 5 de 5 filosofía de la educación
Sesión 5 de 5 filosofía de la educación Sesión 5 de 5 filosofía de la educación
Sesión 5 de 5 filosofía de la educación
 
Projected budgeting FHC A'COSTA RICA'C
Projected budgeting FHC A'COSTA RICA'CProjected budgeting FHC A'COSTA RICA'C
Projected budgeting FHC A'COSTA RICA'C
 
Financial triannual evolution FHC CHINA ASIA
Financial triannual evolution FHC CHINA ASIAFinancial triannual evolution FHC CHINA ASIA
Financial triannual evolution FHC CHINA ASIA
 
Presentation1
Presentation1Presentation1
Presentation1
 
final presentation of my INTERN
final presentation of my INTERNfinal presentation of my INTERN
final presentation of my INTERN
 
Project report software major project
Project report software major projectProject report software major project
Project report software major project
 
SOFTWARE PROJECT MANAGEMENT TOOL Project Report
SOFTWARE PROJECT MANAGEMENT TOOL Project ReportSOFTWARE PROJECT MANAGEMENT TOOL Project Report
SOFTWARE PROJECT MANAGEMENT TOOL Project Report
 
BYS Report
BYS ReportBYS Report
BYS Report
 
Final Internship Report
Final Internship ReportFinal Internship Report
Final Internship Report
 
Online Student Registration System
Online Student Registration SystemOnline Student Registration System
Online Student Registration System
 
Online shopping Report
Online shopping ReportOnline shopping Report
Online shopping Report
 
SRS for online examination system
SRS for online examination systemSRS for online examination system
SRS for online examination system
 
JUSTCABS - an Online Cab Reservation System (Final Year Project)
JUSTCABS - an Online Cab Reservation System (Final Year Project)JUSTCABS - an Online Cab Reservation System (Final Year Project)
JUSTCABS - an Online Cab Reservation System (Final Year Project)
 
Internship Final Report
Internship Final Report Internship Final Report
Internship Final Report
 
Online Voting System Project File
Online Voting System Project FileOnline Voting System Project File
Online Voting System Project File
 

Similar to CS 6390 Project design report

Mobile Transpot Layer
Mobile Transpot LayerMobile Transpot Layer
Mobile Transpot LayerMaulik Patel
 
Computer network (11)
Computer network (11)Computer network (11)
Computer network (11)NYversity
 
Unit 4 tansport layer in the internat
Unit 4 tansport layer in the internatUnit 4 tansport layer in the internat
Unit 4 tansport layer in the internatKritika Purohit
 
the transport layer
the transport layerthe transport layer
the transport layertumetr1
 
Chapter Five - Transport Layer.pptx
Chapter Five - Transport Layer.pptxChapter Five - Transport Layer.pptx
Chapter Five - Transport Layer.pptxGirT2
 
Socket Programming
Socket ProgrammingSocket Programming
Socket ProgrammingCEC Landran
 
Iaetsd an effective approach to eliminate tcp incast
Iaetsd an effective approach to eliminate tcp incastIaetsd an effective approach to eliminate tcp incast
Iaetsd an effective approach to eliminate tcp incastIaetsd Iaetsd
 
Lecture1, TCP/IP
Lecture1, TCP/IPLecture1, TCP/IP
Lecture1, TCP/IPcsyuhk
 
Comparative Analysis of Different TCP Variants in Mobile Ad-Hoc Network
Comparative Analysis of Different TCP Variants in Mobile Ad-Hoc Network Comparative Analysis of Different TCP Variants in Mobile Ad-Hoc Network
Comparative Analysis of Different TCP Variants in Mobile Ad-Hoc Network partha pratim deb
 
UAV Data Link Design for Dependable Real-Time Communications
UAV Data Link Design for Dependable Real-Time CommunicationsUAV Data Link Design for Dependable Real-Time Communications
UAV Data Link Design for Dependable Real-Time CommunicationsGerardo Pardo-Castellote
 
Transport Layer Services : Multiplexing And Demultiplexing
Transport Layer Services : Multiplexing And DemultiplexingTransport Layer Services : Multiplexing And Demultiplexing
Transport Layer Services : Multiplexing And DemultiplexingKeyur Vadodariya
 
Tcp header/IP Header/Authentication header
Tcp header/IP Header/Authentication headerTcp header/IP Header/Authentication header
Tcp header/IP Header/Authentication headerFaizan Shaikh
 
tcpheader-151221111244.pdf
tcpheader-151221111244.pdftcpheader-151221111244.pdf
tcpheader-151221111244.pdfEnumulaBhargava1
 

Similar to CS 6390 Project design report (20)

Mobile Transpot Layer
Mobile Transpot LayerMobile Transpot Layer
Mobile Transpot Layer
 
Computer network (11)
Computer network (11)Computer network (11)
Computer network (11)
 
07 coms 525 tcpip - udp
07    coms 525 tcpip - udp07    coms 525 tcpip - udp
07 coms 525 tcpip - udp
 
Lec9
Lec9Lec9
Lec9
 
Mcseminar
McseminarMcseminar
Mcseminar
 
Unit 4 tansport layer in the internat
Unit 4 tansport layer in the internatUnit 4 tansport layer in the internat
Unit 4 tansport layer in the internat
 
the transport layer
the transport layerthe transport layer
the transport layer
 
Mod4
Mod4Mod4
Mod4
 
Chapter Five - Transport Layer.pptx
Chapter Five - Transport Layer.pptxChapter Five - Transport Layer.pptx
Chapter Five - Transport Layer.pptx
 
Socket Programming
Socket ProgrammingSocket Programming
Socket Programming
 
Iaetsd an effective approach to eliminate tcp incast
Iaetsd an effective approach to eliminate tcp incastIaetsd an effective approach to eliminate tcp incast
Iaetsd an effective approach to eliminate tcp incast
 
Jt2517251731
Jt2517251731Jt2517251731
Jt2517251731
 
Jt2517251731
Jt2517251731Jt2517251731
Jt2517251731
 
transport protocols
transport protocolstransport protocols
transport protocols
 
Lecture1, TCP/IP
Lecture1, TCP/IPLecture1, TCP/IP
Lecture1, TCP/IP
 
Comparative Analysis of Different TCP Variants in Mobile Ad-Hoc Network
Comparative Analysis of Different TCP Variants in Mobile Ad-Hoc Network Comparative Analysis of Different TCP Variants in Mobile Ad-Hoc Network
Comparative Analysis of Different TCP Variants in Mobile Ad-Hoc Network
 
UAV Data Link Design for Dependable Real-Time Communications
UAV Data Link Design for Dependable Real-Time CommunicationsUAV Data Link Design for Dependable Real-Time Communications
UAV Data Link Design for Dependable Real-Time Communications
 
Transport Layer Services : Multiplexing And Demultiplexing
Transport Layer Services : Multiplexing And DemultiplexingTransport Layer Services : Multiplexing And Demultiplexing
Transport Layer Services : Multiplexing And Demultiplexing
 
Tcp header/IP Header/Authentication header
Tcp header/IP Header/Authentication headerTcp header/IP Header/Authentication header
Tcp header/IP Header/Authentication header
 
tcpheader-151221111244.pdf
tcpheader-151221111244.pdftcpheader-151221111244.pdf
tcpheader-151221111244.pdf
 

CS 6390 Project design report

  • 1. Programming Project Design Report (CS 6390.001) Group Members- Abhishek Datta (axd151630), Raj Gupta(rxg164730) Implementation at network-level: a> Functionality of a Fog Topology/distributed system including a bunch of nodes, interacting with each other to provide relevant cloud services (like computation, networking and storage to IoT devices at lower level) thereby considerably reducing the response-time delay incurred in IoT device-requests processed by the cloud. Operation of fog-node roughly includes 2 specific tasks – 1> Receive request packets from IoT devices at UDP port, and either processing or forwarding to neighbouring nodes on TCP connections based on max response-time limit; 2> Periodic exchange of current queuing-time information with 1-hop neighbours so that each node can decide its best neighbour to forward the packet. b> Simulation of the cloud-node functionality in the form of an independent thread implementation having a considerably long enough queue, that can process any request that is forwarded towards it. Request packets can be forwarded by any fog-node (in case maximum forward-limit of a packet reached) over TCP connections established between individual fog-nodes and the cloud. c> For debugging and testing purposes, the response packet received by the IoT device from the fog/cloud should have the complete information of its own path traced across several fog-nodes before being accepted and processed by any node. On receipt of any packet, the IoT device should be able to print (in plain text) from the message body, a consolidated information of all the fog nodes visited and activity performed at each node on the request packet until it is processed. Assumptions considered during implementation: 1. A working model of IoT node implementation should be available beforehand, that continuously generates request packets in specified format and randomly forwards to the fog-nodes. The request-packet message body should follow the pre-decided format below: - Packet sequence-number Request-type Forward Limit IP-address of the request generator UDP port-number of request generator 2. The IoT device request-generator should have prior knowledge on the IP-address/UDP port information for each of the fog-nodes that it receives as input in the beginning. 3. The connection between IoT node and each fog-node should run on UDP (connectionless) socket implementation. On the other hand, all fog-nodes should interact among themselves and with the cloud-node over TCP sockets. 4. It can be inferred from the description that, a Request-type of x (should be a numerical value included in the message body of any packet) should be implied as the processing time of x units (in secs). No further calculation is needed to derive processing delay of any new packet. 5. The Maximum Response-time for any fog-node exceeding which a node must forward packets to the next best neighbour/cloud, should be entered as an input parameter while running a fog-node on terminal with below command: FogNode Max_Response_Time t MY_IP MY_UDP MY_TCP N1 TCP1 N2 TCP2... 6. The forward limit for each request packet obtained from the message body of the corresponding packet, should be the decided max hop-limit after which an unprocessed request should be forwarded to the cloud.
  • 2. Code-level implementation: Implementation of fog-node/cloud functionality will be done in C/Java programming language at all levels. TCP/UDP listener sockets (for receiving packets) and worker sockets (for processing per request-packet in a fog- node) will be implemented as multiple threads in Java. Another higher level of multi-threading will be implemented while designing active fog-nodes that can parallelly process request-messages randomly posted by the IoT request generator. The active threads (representing fog- nodes) will be maintained in a thread pool (i.e. the fog topology) which can act on any number of request-packets periodically generated by the IoT devices. Generic Approach and Understanding: Packet forwarded over TCP connection to cloud-node in case Forward limit reached at R1 or R2 or R3 etc UDP UDP packet 2 UDP packet 4 UDP packet 1 UDP packet 3 1> All fog-nodes in the topology, run on the terminal with below command: FogNode Max_Response_Time t MY_IP MY_UDP MY_TCP N1 TCP1 N2 TCP2... 2> IoT request generator receives input IP/UDP port information from the fog-nodes (declared in the terminal), and runs below command in terminal: IoTreqGen interval IP1 UDP1 IP2 UDP2... 3> Fog-nodes begin exchanging periodic updates on current queueing time delay with its 1-hop neighbours (as specified in the terminal command run for each node i.e. N1, N2 etc) after every t secs (passed as an input argument in the terminal command). Fog-nodes interact over TCP sockets establishing connections among nodes, where one in a pair acts as a ser -ver socket and listens on the TCP port identified in terminal command and the other acts as a client socket, sending update. Initially queueing time for each node calculates as 0 4> Each fog-node listens for incoming request messages on its UDP port (as identified in terminal command). Cloud node Periodic TCP updates (t secs) Periodic TCP updates (t secs)
  • 3. On receipt of any new message Rnew from IoT request generator, the listener socket calculates its response time (Queueing delay of all currently queued messages + Processing time for Rnew, as derived from request- type) and compares with Max response-time (passed as an argument in terminal command of the node). Timer function is called and checked for t seconds since last periodic update; in such case repeat step 3 again. 5> In case of response-time for Rnew < Max Response-time, it adds the new request to end of the processing queue. Otherwise, the request packet is forwarded to next best neighbour with least queueing time (based on last periodic queueing-time update exchanged between 1-hop neighbours) thereby decrementing the Forward Limit field in the message body. Care should be taken, not to re-forward to the best neighbour from which the packet has been received, in which case it should be forwarded to the 2nd best neighbour in the list. Timer function is called and checked for t seconds since last periodic update; in such case repeat step 3 again. 6> In case Forward-Limit equals 0 while decrementing, it forwards the request packet towards the cloud-node over TCP connection to the fixed-IP address/ TCP port defined for the cloud. Also in step 5 if there is no best neighbour left in the periodic update list of the fog-node, it directly sends the packet towards the cloud-node. Therefore, cloud is always the last priority in the periodic update list for any fog-node. Timer function is called and checked for t seconds since last periodic update; in such case repeat step 3 again. 7> In case the fog-node is unable to process the request-packet due to exceeding Max response-time of that node, it appends a short information text at the end of the text-string within the message body and propagates towards the next best neighbour. Continuing the process at each hop until the packet is processed, a complete overview of the visited fog-nodes and activities performed by each node is printed when the response packet arrives back at the IoT device. For debugging reasons, below information per fog-node is enough to track the packet flow: FogNode ID, Response-time calculated, Next Best neighbour, Neighbour’s queue-time update Handing the looping problem: Let suppose, the periodic TCP queueing update messages among the fog-node R2’s 1-hop neighbours creates a best-neighbour decision table in below format: Fog-node IP Fog-node TCP port Neighbour IP Neighbour Port Queueing time(secs) R2 (192.x.x.x) 1000 R1 (192.y.y.y) 2000 25 R2(192.x.x.x) 1000 R3 (192.y.y.z) 3000 20 R2(192.x.x.x) 1000 R4 (192.y.y.x) 4000 15 R2(192.x.x.x) 1000 Cloud (10.0.0.1) 8080 Infinity Case 1: According to the above table, R2 should decide its best-hop neighbour as R4 as queueing delay is least (15 secs) for R4 fog-node. In such cases, when the request packet has arrived from a fog-node to R2 which is later decided as the best 1-hop neighbour, R2 should offload the packet to the 2nd best neighbour R3 (with next best queueing time 20 secs) to avoid looping problem among R2 and R4. Queueing delay = 25 Max response-time reached Queueing delay = 20 Request packet forwarded by 4 Queueing delay = 15 1 2 3 4
  • 4. Case 2 (leaf node): According to the above table, R2 should decide its best-hop neighbour as R4 as queueing delay is least (15 secs) for R4 fog-node. In this case, when the request packet has arrived from a fog-node (R4) to R2 which is later calculated as the best 1-hop neighbour for R2, it should offload the packet to the 2nd best neighbour R2 (with next best queueing time 20 secs) to avoid looping problem among R2 and R4. If R1 also has its max response-time exceeded, it has no other neighbour to forward to since R2 has already offloaded the packet towards R1. In such cases, it should directly send the packet to cloud-node Ip address/port number defined. Cloud Packet forwarded by 2 Queueing delay = 20 Max response-time reached Queueing delay = 25 Request packet forwarded by 4 Queueing delay = 15 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 2 3 4