Jump to content

Recommended Posts

Posted (edited)

I am a beginner in the field and I don't know whether it is too silly to ask.

What is the physical location(if any) of the four layers in TCP/IP model?

Suppose I am using the application gmail, and has pressed the send button after typing in the mail when does application layer come into play and where is it located?Is it a part of the software and what of the other three layers?

Edited by Alphaplus
Posted (edited)

In socket library you have couple functions such as:

socket()
https://msdn.microsoft.com/en-us/library/windows/desktop/ms740506(v=vs.85).aspx

It takes couple parameters, whether socket has to be TCP or UDP, ICMP, whether it has to be IPv4 or IPv6 etc. etc.

Once you have socket,
you should tell socket to which IP to connect, and at which port. It's done by using connect() function:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms737625(v=vs.85).aspx

IP can be given as series of numbers f.e. 192.168.0.1 or by name.
If it's by name you should ask DNS (Domain Name Server), to what IP by numbers it will resolve.

gethostbyname()
https://msdn.microsoft.com/pl-pl/library/windows/desktop/ms738524(v=vs.85).aspx

At the end there has to be used send() function

https://msdn.microsoft.com/en-us/library/windows/desktop/ms740149(v=vs.85).aspx

 

Example code using all functions is at the bottom of above MSDN link.

 

Depending what protocol you're using you might want to wait for reply to arrive back using recv()

https://msdn.microsoft.com/en-us/library/windows/desktop/ms740121(v=vs.85).aspx

 

Suppose I am using the application gmail, and has pressed the send button after typing in the mail when does application layer come into play and where is it located?

 

If you meant Android gmail application, it's probably using JavaMail API

http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a

Edited by Sensei

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.