http://www.girishgaurav.com/js/ga_social_tracking.js

»

Jun 14

Introduction to Nonblocking Sockets




Nonblocking System Architecture

  • Server: the application receiving requests.
  • Client: the set of applications sending requests to the server.
  • Socket channel: the communication channel between client and server. It is identified by the server IP address and the port number. Data passes through the socket channel by buffer items.
  • Selector: the main object of all nonblocking technology. It monitors the recorded socket channels and serializes the requests, which the server has to satisfy.
  • Keys: the objects used by the selector to sort the requests. Each key represents a single client sub-request and contains information to identify the client and the type of the request.

Figure 1 illustrates the architecture of a system using nonblocking sockets.

Figure 1. Nonblocking socket architecture

As you may notice, client applications simultaneously perform requests to the server. The selector collects them, creates the keys, and sends them to the server. This may seem like a blocking system, because the requests are processed one at a time; actually, it is not like that. In fact, each key doesn’t represent the entire information stream a client sends to a server, but just a part. We don’t have to forget the selector divides the client-data in sub-requests identified by the keys. Consequently, if more clients continuously send data to the server, the selector will create more keys, which will be processed according to a time-sharing policy. To emphasize that, in Figure 1 the keys have the same color of their related clients.

1 comment

  1. mantar hastalığı

    Excellent goods from you, man. I’ve understand your stuff previous to and you are just too excellent. I really like what you have acquired here, certainly like what you are stating and the way in which you say it. You make it enjoyable and you still care for to keep it smart. I can not wait to read far more from you. This is really a terrific web site.

Leave a Reply

%d bloggers like this: