2

I am studying networking and OSI model and all 7 layers. Like how each layer puts its own header and then removes on the receiver end.

Is there any way that i can create the program in java or c or c++ and i manually perform each step which is done at layers so that i actually know how it actually works

Edit: ok first consider locally For example i have data word "hello" and i want to send it to another running program simulating the OSI model. That word ill go trough the all layers and they will add their headers and stuff like OSI does and then other running program will receive it.

Basically TCP/ip protocol has to be programmed i think but may be experineced person can get it better

then i can manually change the bits to check whether error control works ok or not

4
  • 4
    The OSI model isn't a real program (or even a set of real protocols). It's just a model. What is that you would like your program to do? Jan 16, 2011 at 13:49
  • 1
    Actually TCP/IP doesn't fit OSI model (en.wikipedia.org/wiki/TCP/IP_model).
    – ssmir
    Jan 16, 2011 at 15:28
  • 1
    You might like to experiment with an open source TCP/IP stack to study how packets are processed. There are plenty to choose from, but a lightweight implementation such as opentcp.cvs.sourceforge.net/viewvc/opentcp/opentcp may be easier to start with.
    – makes
    Jan 16, 2011 at 15:55
  • You are studying a failed project and an implementation model of a failed network stack architecture, and it is all twenty years out of date. What you should be studying is the TCP model.
    – user207421
    Jan 17, 2011 at 1:05

1 Answer 1

3

Since the OSI model has 7 layers:

  1. Physical
  2. Link
  3. Network
  4. Transport
  5. Session
  6. Presentation
  7. Application

and you want to emulate it in a Java (or possibly C) environment, then you're going to need to do a moderate amount of work.

For the purposes of your simulation, you'd probably treat the normal TCP/IP sockets layer as the physical layer - in your simulation, it achieves connectivity between endpoints. It is a remarkably reliable physical layer, but you can't have everything.

You can then simulate each of the successive layers - Link, Network, Transport, Session, Presentation, Application - layers with appropriate code that puts data into packets, or splits up packets, and adds headers and check sums and so on. Each layer except the application has two interfaces: the downward interface (to the lower-numbered layer) and the upward interface (to the higher-numbered layer). You'll need to decide on appropriate operations for each layer. A minimal set is likely to be: open, close, read, write.

I'd start simple - with either the bottom or the top (either direction could work). Since you'll need an application anyway (test code if nothing else), you might start there. You'll successively refine the code adding extra layers, ensuring the previous functionality continues to work. You'll have to work out how the application layer conveys to the data link layer the information that it needs - so that the correct socket calls can be made, etc.

Have fun.

3
  • thanks buddy , i tried getting the idea from tcp/ip implementstion in linux using c , but the code/ data structures were very difficult to understand
    – John
    Jan 17, 2011 at 9:58
  • leffler .. by doing so and sending a packet to other pc the OS will again do the network layer n other layer's work or not... where are the other layers than application layer implemented in a computer.. Can we able to bypass it.. Jan 24, 2011 at 1:18
  • You can bypass the double work, but only if you know enough not to be asking the question in the first place. I could not do it easily; it would take me a lot of work that I'd rather not do. Fortunately, I don't have to emulate OSI over TCP (or anything else). Jan 31, 2011 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.