06-06-2012, 03:23 PM
Algorithms and Issues In Client Software Design
Client Software Design.ppt (Size: 141.5 KB / Downloads: 5)
Problem in choosing a local IP Address
When forming a connection endpoint, a client must choose a local IP address as well as a local protocol port number.
Host attaches to one network, the choice of a local IP address is trivial.
Routers or multi-homed hosts have multiple IP addresses, making the choice can be difficult.
Communicating With The Server Using TCP
Assuming connect call succeeds in establishing a connection , the client can use the connection to communicate with server.
The application protocol specifies a request-response interaction.
Usually, a client calls write to transmit each request & read to await a response.
For simple applications protocol.
For complicated applications protocol.
Reading A Response From A TCP Connection
Example shows a client that sends a small message to a server & expects a small response.
The code contains a single call to write, but makes repeated calls to read.
Sends only a small amount of data because TCP is not a block-oriented protocol.
Instead, TCP is stream-oriented: it guarantees to deliver the sequence of bytes that the sender writes.
Communicating With A Server Using UDP
After a UDP client calls connect, it can use to send a message or read to receive a response.
Unlike TCP,UDP provides message transfer.
Each time the client calls write UDP sends a message to the server. The message contains all the data passed to write.
Similarly, each call to read returns one complete message.