next up previous contents index
Next: Configuring request generation Up: 32.5 Web client Previous: 32.5 Web client Creating a client

First of all, we create a client and connect it to a cache and a web server. Currently a client is only allowed to connect to a single cache, but it's allowed to connect to multiple servers. Note that this has to be called AFTER the simulation starts (i.e., after $ns run is called). This remains true for all of the following methods and code examples of Http and its derived classes, unless explicitly said.

        # Assuming \$server is a configured Http/Server. 
        set client [new Http/Client \$ns \$node] # client resides on this node;
        \$client connect \$server # connecting client to server;