Skip to content
Skip to main content

About this free course

Download this course

Share this free course

Protocols in multi-service networks
Protocols in multi-service networks

Start this free course now. Just create an account and sign in. Enrol and complete the course for a free statement of participation or digital badge if available.

3.4.2 Primitives

TCP primitives are implemented as application program interfaces (APIs). Those provided on a particular computer system depend on how the TCP software is written. I shall now briefly describe the abstract interface given in the specification of TCP. You should bear in mind that, although specific implementations will perform similar functions, the methods of achieving them may differ. Table 5 lists the primitives and their parameters. Most of the parameters are fairly self-explanatory but parameters of the open primitive are described below.

Table 5: TCP primitives
Primitive namePrimitive parameters
AbortLocal connection name
CloseLocal connection name
OpenLocal port number, foreign socket, active/passive flag, time-out, precedence, security/compartment, options
Returns a local connection name
ReceiveLocal connection name, buffer address, byte count
Returns a byte count and status of the urgent and push flags
SendLocal connection name, buffer address, byte count, push flag, urgent flag, time-out
StatusLocal connection name
Returns status data about the network addresses, port numbers, state, buffers, etc.

The local port number in the open primitive is the 16-bit number chosen by the application to identify itself. The foreign socket identifies the host to which it wants to be connected, and consists of the network address and port number of the destination host.

The active/passive flag indicates the type of open primitive. An active open will begin to open a specific connection immediately, whereas a passive open will cause the host to listen for an incoming connection. For example, an HTTP server may request a passive open for port 80 which indicates that it is willing to receive HTTP commands from any host that has a destination port of 80.

The open primitive returns a local connection name, which is specified in other primitives to identify the connection.

The operation of the transmission control protocol follows that of a finite state machine, and Figure 19 shows a state diagram representation of the TCP connection management. However, not all possible state changes are represented in this simplified diagram. It is meant to illustrate the operation of TCP, not to be a specification.

Figure 19
Figure 19 TCP connection finite state machine

SAQ 9

Amend the signal sequence diagram in Figure 19 to show the state of each host after it receives an incoming signal. Assume that the TCP entities in both hosts start in the ‘CLOSED’ state. You will need to infer the arrival of a primitive for some state transitions and you should include the primitives on the diagram.

Answer

See Figure 20. The names of the states appear in rectangles at appropriate points in the signal sequence diagram.

Figure 20
Figure 20 Answer to SAQ 9

SAQ 10

Briefly describe what you believe is the function of each primitive listed in Table 5 based on its name and its parameters.

Answer

My descriptions are given below:

  • abort – to terminate a connection and discard all pending data awaiting transmission or reception;

  • close – to clear a connection once all data awaiting transmission is transmitted;

  • open – to open a connection, in either passive or active mode;

  • receive – to allocate buffer space to store incoming data;

  • send – to indicate the buffer containing the data to be sent over a connection;

  • status – to request information about the status of a connection.

The primitives are described more fully in RFC 793.