Find Jobs
Hire Freelancers

a simple web client and web server

$30-50 USD

Cancelado
Publicado há aproximadamente 14 anos

$30-50 USD

Pago na entrega
**learn how a web server and web client work, and learn how to design a web server. Although this project requires an understanding of TCP socket programming, it provides the students a sample code to start.** ## Deliverables **Activity 2**: Compile the source code in Visual C++ .NET: 1. Compile the source codes in directory api and create a library for application programs to use. To do this, follow the following steps: 1. Create a project: start Visual C++ .NET, select “New?? from the drop-down “File?? menu, select “Projects?? in the popup pane and then select “Managed C++ Empty?? in the list. Then select the proper location in the “Location?? field and type a name, say “lib1?? in the “Name?? filed. Click on “OK??. The Solution Explorer Window should appear on the left. If not, go to the main menu bar and select View -> Solution Explorer.? 2. Go to the Solution Explorer window, right click on Source Files under lib1, then Add Existing Items. Add all files in the api directory. Right click on Header Files then Add Existing Items. Add all files in the h directory. 3. In the Solution Explorer window, right click on the name of the project, select “Properties??. Then click on “General??. Under “Project Defaults??, choose “Configuration Type??. Click the empty field on the right. From the pull down menu, choose “Static Library (lib)??. 4. Still inside the Property window, choose C/C++? -> General ->Additional Include Directories. Click on the field and choose the location of the h directory which you extracted in Activity 1. 5. Still inside the Property window, choose Librarian ->General ->Output file. Click on the empty field on the right and type in a name of the library file, say “[login to view URL]?. 6. Build the library: Right click on lib1 and choose Rebuild. “[login to view URL]? should be built. 1. Build the web client: 1. At the very top of the Solution Explorer window, right click the Solution and Add->Add New Project. Select “Managed C++ Empty?? in the list. Then select the proper location in the “Location?? field and type a name, say “client?? in the “Name?? filed. Click on “OK??. Then add “webclient.c?? in apps directory to Source Files. Then add all files in the h directory to Header Files. 2. Repeat 1.d 3. Add libraries into the project settings: Click on “client?? in the Solution Explorer window and select “Project Dependencies??, then click on “lib1?? in the popup pane. (If you use Visual Studio .NET **2003**, you need to go through Properties -> Linker -> General ->Additional Library Directories and add the directory where [login to view URL] resides, e.g., the Debug directory inside lib1) 4. Configure the linker: Click on “client?? in the Solution Explorer window and select “Properties??, then click on Linker->General. Change the output file to “$(OutDir)/[login to view URL]?. Under Linker->Input->Additional Dependencies, add ws2_32.lib. 5. Build webclient.exe. 3.? ? ? ? ? ? Build the web server: Follow the same steps for building the web client (by replacing "webclient.c" by "webserver.c"), except that you must also include source file “readln.c?? (located in apps folder) in your project. **Activity 3**: Read apps/webserver.c to learn how to run webserver. Also, you must run webserver in command line interface. Run the webserver in apps directory, type:? webserver / 8080 **Activity 4**: Read apps/webclient.c to lean how to run webclient. You must run webclient in command line interface. Run webclient in the same directory (in another window) to get the web page: ? webclient localhost / 8080 webclient localhost /time 8080 webclient [login to view URL] / See what show up in the screen. Then, use netscape or Internet Explorer to get the page: invoke netscape and then type <http://localhost:8080/> and <http://localhost:8080/time> in the address pane. See what show up in the window. **Activity 5**: Use another computer to read the web page. Firstly, use ifconfig (Linux) or ipconfig (Windows)? to find out the IP address of the machine where webserver is running: ifconfig ??"a ? ? ? ? ? ? on Linux, or ipconfig? ? ? ? ? ? ? ? ? ? ? on Windows Then, start a web browser (netscape or internet explorer) in another machine. Type http://<[login to view URL]>:8080/ in the address pane and see if you can get the web page. **Activity 6**: Read webserver.c to learn how it works. Specifically, look how webserver sends out the HTML document and from where to read it. Move the HTML document which is stored in string constant HOME_PAGE to a file called [login to view URL] in a directory you choose as the root directory of your directory tree where you put your documents; and modify webserver.c so that it reads HTML document from [login to view URL] when the client send a request with path /. (your server must know where to find the [login to view URL] file). Use a web browser to check your web server works. Note: An HTTP request is composed of 3 parts: a web address, ex., [[login to view URL]][1]; an application (or port) number, ex., 8080 (the default port number is 80); and a path of a file, ex., /faculty/linh/misc.html. If no file name is given in the path, by default [login to view URL] or [login to view URL] will be requested. For example, in URL [login to view URL], the web address is: [[login to view URL]][1], the port number is 8080; and the path is /facility/computers.html. **Activity 7**: Replace the content of [login to view URL] file with HTML document for another web page. Use a web browser to get that page. ## Activity 8: Add functionality to the web server so that it can handle a request for an arbitrary file. This activity allows students learn how the web server handles a client request for an arbitrary file. So far, we have built a server which can only handle a request for the default web page “[login to view URL]? with path “/??. Generally, a web client can require for any file with a long path, e.g., the following URLs require “[login to view URL]? and “/doc/[login to view URL]?: <[login to view URL]> <[login to view URL]> In this activity, students need to modify the webserver.c program to handle the request with arbitrary file name. It will check the existence of the requested file. If no such file exists, it will send a “No file found?? message to the client; otherwise, it will send the requested file to the client. **Step 1:** Modify the webserver.c source code so that it can handle requests with any path as described above. **Step 2**: Put [login to view URL] file in the root directory of your directory tree as you have done in Activity 6. Put other files in your directory tree and insert links in your [login to view URL] file to point to those files. Use a web browser to connect to the webserver with path “/??. The web page contained in “[login to view URL]? should appear in the browser. Then, click on the links in the webpage. Successive pages should appear. Look at the path in the URL window. You should see that files contained in the subdirectories should be requested. **Activity 11**: Submit your webserver.c program (**source code** and **executable**) and the **HTML files** you used to test your program through WebCT. You should fully test your program before submission**. The html files should be in the same directory where the executable is. Your program must work even when the directory is arbitrary.**
ID do Projeto: 3194175

Sobre o projeto

Projeto remoto
Ativo há 14 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos

Sobre o cliente

Bandeira do(a) UNITED STATES
United States
0,0
0
Membro desde fev. 19, 2010

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos Publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.