Thread: Data link / Application layers

  1. #1
    Registered User
    Join Date
    Mar 2008

    Data link / Application layers

    Could anyone make a simple example of an implementation in C of 2 separate layers, application and data link? In the program i need to make, they communicate with pre-defined functions, and the data link layer uses stop-n-wait or sliding window, which ill implement. The data link will use UDP sockets, but they will be included in pre-defined functions, so all i need to know is how to make the structure of the 2 layers program for this situation. Thanks in advance.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    Generally, the application layer is a packet within a bigger packet that is the data link. The purpose of the data link is to ensure the packet arrives correctly to the right application and complete with the correct content.

    I don't have any direct example, but the data structure may be something like this:
    struct header
        int magic;      // A magic number that indicates the start of a packet. 
        int pktsize;    // Size of the payload (application) data. 
        int hdrsize;   // Size of this header 
        int pktcsum;  // checksum of the payload data.
        int recipient;  // Who it's for. 
        int sender;    // Who sent it
        int hdrcsum;  // checksum of the header (it's last, so we can calculate it from the other components)
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. get application data folder path
    By skuallpa in forum C++ Programming
    Replies: 4
    Last Post: 06-12-2009, 03:19 PM
  2. Having a button link to another application -help?
    By Diablo02 in forum C# Programming
    Replies: 9
    Last Post: 09-30-2007, 09:16 PM
  3. question about a working linked list
    By cold_dog in forum C++ Programming
    Replies: 23
    Last Post: 09-13-2006, 01:00 AM
  4. Link to outside data in list view
    By eth0 in forum Windows Programming
    Replies: 5
    Last Post: 01-13-2006, 05:08 AM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM