2012年10月18日星期四

3310 – ComputerNetwork(2)

    After about four weeks’study on the course 3310, I, together with the professor, has gone through several important parts about socket programming. In addition, for socket programming, we have discussed not only the architecture but also the usage about many kinds of functions used for setting up communication between two peers, such as socket(), bind(), listen() and so on. Professor liew is introducing service Models and ARQ, which is for the peer-to-peer protocol communication, to us in the recent lectures, which contains detailed information about adaptation functions and two kinds of ARQ—Stop and Wait ARQ and Go-Back-N ARQ, for which we are discussing about both the advantages and disadvantages as well as how to make choice of these two types.

Figure 1 – Architecture ofSetting Connection-oriented Socket

Figure 2 – Model forStop-and-Wait ARQ
     After a period time ofstudying, I gradually build up the framework ofhow people can set up communication between two different places, which may befar far away from one to the other. What I am doing now is to fill theframework with detailed information and knowledge. For example, by learning, Iget to know the detailed method and process for computers to set up specificports and sockets between clients and servers. What I also learned is how toprevent conditions like transmission error and time-out by the method of ARQ.

    Besides the knowledgegained in the lectures, I also find that the course is no longerthat much mysterious to me. In other words, I become to realize the mainpurpose of this technology as well as begin to consider practical problems fromthe specific points of view of the technology.

    To learn the coursewell, in the past four weeks, I take the advice about insistingreading lecture notes as well as textbook for more than one hour per day fromprofessor liew. While reading the notes and the textbook, my goal is tounderstand how it is working and why people would design it like that, inaddition, I would try to think about my own ideas, which may look stupid ifcompared with the methods introduced in the lecture.

Topic:Comparison Between Two Functions – write() andsendto() 

    For socket programming, there are two kinds of functions that are for the same goal – senddata from one terminal to the other when communicating, they are write() andsendto(). The fundamental purpose of defining two different functions isbecause of the different usage for connection-oriented socket andconnectionless socket. Therefore, the architecture of these two kinds of socketis somehow different, which is shown as below:
Figure 3 – ComparisonBetween Two Functions in Corresponding Architecture
    Also, the two functionshave different prototypes, which are :
      int write ( int sd, char *buf, intbuflen ) ;
      int sendto ( int sd, char *buf,int buflen, int flags, stuct sockaddr *addrp, int addrlen) ;                                      
                                 --Communication Networks (Alberto Leon-Garcia)

    From the above two lines,we can see that thetwo functions have three consistent components :
           sd is the socket descriptor,
           buf is a pointer to a buffercontaining the data to traansmitted ,
           buflen is the length of the data inbytes .                                       and also the sendto() function have three extra components :
           flags can be used to controltransmission behavior such as handling out-of-band data
           addrp is a pointer to the sockaddrstructure containing the address information of the remote hosts
           addrlen is the lengeh of theaddress information

    From my point of view, through the differences above we can easily see why sendto() is especially for connectionless, each time when sendto() is called, it will send datas with both source and destination addresses, which is no need for connection-oriented. And thus we can draw a conclusion that the essential difference between these two function is that one is for connectionless and the other is for connection-oriented.
 
    In the further study, I would like to have the chance to have actual practice by using these socket functions, which will absolutely improve my acknowledge of the process of sending data by using different protocols.


没有评论:

发表评论