Write a client program which invokes Form.cgi with POST method specified, using either the stream socket API or the URL class.

Hand in the program listings.


The data that needs to be exchanged is shown below:
```
>telnet www 80
Trying 129.65.241.7...
Connected to tiedye-srv.csc.calpoly.edu.
Escape character is '^]'.
POST /~mliu/form/postForm.cgi HTTP/1.0
Content-type: application/x-www-form-urlencoded
Content-length: 11

name=Donald
HTTP/1.1 200 OK
Date: Sun, 24 Feb 2002 22:52:33 GMT
Server: Apache/1.3.9 (Unix) ApacheJServ/1.0
Connection: close
Content-Type: text/html

Query Results

You submitted the following name/v
alue pairs:



  • name = Donald
    Connection closed by foreign host.
    ```

    ```
    //HTTPClient
    try {
    String query = "name=Donald%20Duck&quest=gold%20medal";
    InetAddress host =
    InetAddress.getByName("www.csc.calpoly.edu");
    int port = 80;
    String fileName = "/~mliu/form/postForm.cgi";
    String request =
    "POST " + fileName + " HTTP/1.0\n" +
    "Content-type: application/x-www-form-urlencoded\n"+
    "Content-length: " + query.length( ) +"\n\n" +
    query;
    MyStreamSocket mySocket =
    new MyStreamSocket(host, port);
    /**/ System.out.println("Connection
    ```

    Computer Science & Information Technology

You might also like to view...

A class that inherits from a base class is a ____ class.

A. super B. lower C. derived D. parent

Computer Science & Information Technology

You must create all of your own layouts within PowerPoint 2013

Indicate whether the statement is true or false

Computer Science & Information Technology

A methodology and formal development strategy for the design and implementation of an information system is referred to as a __________.

A. systems design B. development life project C. systems development life cycle D. systems schema

Computer Science & Information Technology

Paul is playing a game when his computer shuts down unexpectedly. Paul has noticed recently that his fans are running very loud. When Paul turns his computer back on, it starts to boot and then shuts off again. ? What is a possible problem with Paul’s computer?

A. Windows is not installed. B. Fan drivers are not working. C. Hard drive is failing. D. Computer is overheating.

Computer Science & Information Technology