TCP and UDT ?

Discussion in 'Programmer's Corner' started by rougie, Aug 11, 2012.

  1. rougie

    Thread Starter Active Member

    Dec 11, 2006
    410
    2
    Hello,

    Okay, it's been 3 weeks I have been reading/watching Ethernet tutorials and I haven't stopped ... LOL :D

    Wow, this Ethernet/networking stuff is endless...

    I would like to ask you guys something. Is anyone familiar with TCP and UDP protocols being used in embedded systems? Although I got an Ethernet demo to work and all ... there are some questions about the details of what is going on between the TCP/UDP (transport layer within the TCPIP stack) and the actual functions in my C code.

    In my C code within my micro-controller, I have access to two functions which are called from the transport layer and here are their prototypes:

    unsigned int Ethernet_UserTCP(unsigned char *remoteHost, unsigned int remotePort, unsigned int localPort, unsigned int reqLength, TEthPktFlags *flags);

    unsigned int Ethernet_UserUDP(unsigned char *remoteHost, unsigned int remotePort, unsigned int destPort, unsigned int reqLength, TEthPktFlags *flags);

    I believe that the first function is called from the transport layer when it uses TCP. And the second one is called from the transport layer when it uses UDP.

    The compiler that provides the Ethernet library which comprises public functions like the ones shown above, does not have any tutorial(s)
    available for their customers yet. So I am trying to piece all of this stuff together and it really isn't easy for me. :eek:

    So to begin, I have a simple question regarding TCP/UDP and the two prototypes above.

    If I have a computer and an embedded web server connected to the same router and I go on google and type in the web server's address using http like this:

    http://192.168.1.60

    I will obviously see the web page from the embedded web server displayed on my pc. Now.... what just happened there exactly in terms of TCP/UDP and the two functions shown above.

    I get the fact that the browser will load the HTML packet from my embedded web server via port 80 (I believe) and that the browser will start to execute the HTML code retrieved from the packet. However, I need a little more detail here :rolleyes:

    QUESTION:
    So again, lets recap... When I type in: http://192.168.1.60' in my browser, what is the first thing that happens when the browser reaches the embedded web server ????

    A) Does it use TCP or UDP?
    B) If it uses TCP does it call the Ethernet_UserTCP() function ?
    C) If it uses UDP does it call the Ethernet_UserUDP() function ?
    D) Does it use both TCP and UDP and calls both functions?

    Without showing the small code that exists in the two functions, I can pretty much see that they are responsible for setting the HTML code that is hard coded in a global unsigned char array. But I tried setting breakpoints in these functions and the code execution mostly uses the TCP function. But also it used the UDP function but very seldom ... I have trouble following the whole thing :confused:

    Any help is really appreciated!

    Thanking all in advance for your help.
    roberto
     
    Last edited: Aug 12, 2012
  2. marchon

    New Member

    Aug 18, 2012
    1
    0
    Answers: (questions below)

    A) The HTTP protocol is implemented in TCP. HTTP holds an active connection link over a TCP Socket.

    What level of detail would you be interested in for the following questions

    * for the embedded device to "ACCEPT" a connection / it must have setup a socket to be LISTENING for it.

    Once the Socket gets a Connection Request - it hands of a New Socket Handle - which contains a "socket" representing the conversation between itself and the originating host.

    I would enjoy answering questions for you on this topic in a more "interactive manner" to better understand you questions. I have implemented both the server and client side of HTTP and much of the implementation detail is abstracted from the developer due to the nature of the protocols.

    contact me via gtalk or gmail at m a r c h o n (at) g m a i l (dot) m o c

    -- oh reverse that last part ;-)

    George.


    B) If it uses TCP does it call the Ethernet_UserTCP() function ?



    QUESTION:
    So again, lets recap... When I type in: http://192.168.1.60' in my browser, what is the first thing that happens when the browser reaches the embedded web server ????

    A) Does it use TCP or UDP?
    B) If it uses TCP does it call the Ethernet_UserTCP() function ?
    C) If it uses UDP does it call the Ethernet_UserUDP() function ?
    D) Does it use both TCP and UDP and calls both functions?

    Without showing the small code that exists in the two functions, I can pretty much see that they are responsible for setting the HTML code that is hard coded in a global unsigned char array. But I tried setting breakpoints in these functions and the code execution mostly uses the TCP function. But also it used the UDP function but very seldom ... I have trouble following the whole thing

    Any help is really appreciated!

    Thanking all in advance for your help.
    roberto
     
  3. bikithalee

    New Member

    Jun 5, 2012
    1
    0
Loading...