25.02.2013 Views

TCP/IP Tutorial and Technical Overview - IBM Redbooks

TCP/IP Tutorial and Technical Overview - IBM Redbooks

TCP/IP Tutorial and Technical Overview - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The connectionless scenario is simpler in that the listen(), accept(), <strong>and</strong><br />

connect() functions are not invoked. Table 11-1 compares the socket API<br />

functions that are used for connection-oriented <strong>and</strong> connectionless clients <strong>and</strong><br />

servers.<br />

Table 11-1 Socket API function comparison<br />

Client/server connection Establish Send Receive<br />

Connection-oriented server bind()<br />

listen()<br />

accept()<br />

11.2.2 Remote Procedure Call (RPC)<br />

send()<br />

sendto()<br />

write()<br />

Connection-oriented client connect() send()<br />

sendto()<br />

write()<br />

recv()<br />

recvfrom()<br />

read()<br />

recv()<br />

recvfrom()<br />

read()<br />

Connectionless server bind() sendto() recvfrom()<br />

Connectionless client bind() sendto() recvfrom()<br />

Remote Procedure Call (RPC), originally developed by Sun Microsystems <strong>and</strong><br />

currently used by many UNIX-based systems, is an application programming<br />

interface (API) available for developing distributed applications. It allows<br />

programs to execute subroutines on a remote system. The caller program, which<br />

represents the client instance in the client/server model (see Figure 11-1 on<br />

page 409), sends a call message to the server process <strong>and</strong> waits for a reply<br />

message. The call message includes the subroutine’s parameters, <strong>and</strong> the reply<br />

message contains the results of executing the subroutine. RPC also provides a<br />

st<strong>and</strong>ard way of encoding data passed between the client/server in a portable<br />

fashion called External Data Representation (XDR), defined by<br />

RFC 4506/STD 0067.<br />

The RPC concept<br />

The concept of RPC is very similar to that of an application program issuing a<br />

procedure call:<br />

1. The caller process, which represents the client instance in the client/server<br />

model (see Figure 11-1 on page 409,) sends a call message <strong>and</strong> waits for the<br />

reply.<br />

2. The server awaits the arrival of call messages. When a call message arrives,<br />

the server process extracts the procedure parameters, computes the results,<br />

<strong>and</strong> sends them back in a reply message.<br />

Chapter 11. Application structure <strong>and</strong> programming interfaces 415

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!