CS计算机代考程序代写 concurrency python CA2 Question:

CA2 Question:
1. For the Assignment, are we supposed to implement just one server file?
Answer: You can have two files (recommended), one for TCP And one for UDP.
2. How should we show the concurrency ? I am logging on the server side when I receive data and sending response, I would assume that if my timestamp for the 2 receive data event is the same, it shows that they are concurrent(if I’m sending 2 request). However, since the data is just a text input, the time taken to transfer this data is just in a split second, I’m not sure if using timestamps are sufficient in showing concurrency? It is also mentioned that the response should be on a webpage, do we need to show this?
Answer: The way we will validate the concurrency is by connecting multiple clients to your server at the same time. For example, I can open up multiple browsers/tabs and get them all to connect to the server. I don¡¯t need to look at timestamps. When I connect to your server, it should send me a webpage. While grading, we will be checking to see that the webpage is displayed on our browser.
3. I am using folks in my client code to create multiple threads that sends request to server, does this satisfy the part on ‘create multiple HTTP clients’?
Answer: Yes it does. However, you don¡¯t need to submit your client code. You can write your client code for testing if you want. You only submit your server code.
4.
5. Can I clarify whether we can have two files for the TCP and UDP server separately (i.e. tcpserver.py and udpserver.py) instead of ONE server file which was stated in the assignment?
Answer: There should be two files: one for UDP and one for TCP.
6. For the TCP server it should be a webpage displaying “Input text here: ” then it will display the input text?
Answer: Yes. There should be a box next to ¡°Input text here: ¡±. After you enter the text and hit enter, you should get a webpage back that displays the text.
I would like to check for the assignment, are we supposed to create an actual webpage that
would be shown to the client? Or we would just need to simulate it using code response?
Answer: You are supposed to create an actual webpage.

7. I managed to display text on a client server I created and on chrome, is that considered concurrent?
Answer: No. To display concurrency, you would open multiple chrome tabs and get them to connect to the server at the same time.
8. May we get an exmaple on how the TCP and UDP final result should look like as some of us are pretty confused with the instructions.
Answer: The image below shows an example of the webpage you get when you first connect to the server:
The image below shows the webpage you get after you type in your text (e.g. Hello world) and hit enter.
9.
10. Is it ok to use multi threading to handle multiple concurrent clients given that I created the server/client in Python?
Answer: I want to see a separate process for each connection. So ideally you should use fork.
11.
Enter text here:
You typed: Hello world
Can I check how would the evaluation be performed such that we can fine tune the server to match
the client.
Answer: The way we will evaluate your code is by connecting multiple clients to your server at the same time. For example, I can open up multiple browsers/tabs and get them all to connect to the server. I don¡¯t need to look at timestamps. When I connect to your server, it should send me a webpage. While grading, we will be checking to see that the webpage is displayed on our browser.
For the implementation of S1 server, do we need to consider buffer size when receiving data
from client? Will it be possible that the single text input is VERY long and overflows the
buffer such that we need to call recv() multiple times as the data is split into multiple
packets?

Answer: Good programming practice requires that you limit the maximum input. So if you
get more than the buffer that you have allocated to store it, there will not be a problem.
Buffer overflow attacks exploit the fact that many programmers do not check. However, in
this module it is okay if you do not check since the focus is not on security.
12. “You need to automate a way to create multiple HTTP clients to test and show that your servers are concurrent” –> I am not sure what automate means in this context here. Does this
mean that we just code a program for the HTTP client that creates multiple client sockets at the same time that connects simultaneously to the HTTP server?
Answer: By automate I mean that you do not start with a fixed number of servers (e.g., five servers) each of which can handle a client. Instead, you will create a new server process when a new client comes in so that the number of server process that you are running at any point in time will depend on the clients that are currently connected. You can do this by calling fork.
13. “For S2: The HTTP response needs to be a web-page displaying the text ¡°EE-4210: Continuous assessment¡±. ” –> Do we need to first send a HTTP response webpage containing a HTML form asking for client input just like in the case for the TCP server? Or does the UDP server just need to display text ¡°EE-4210: Continuous assessment¡± when a client first connects to it without any text input?
Answer: For the UDP server, there is no form and there is no input by the user. The server just sends out a webpage with the text “EE-4210: Continuous assessment¡±.
14. Can I use external libraries to process the input provided by the POST submission? Answer: Yes.
15. When I clicked the button to update the text, must the request be a POST request, or can it be a get request with query parameters. For example, GET /update?text= HTTP 1.1
Answer: You can use either method.
16. For me to send raw HTTP requests, can I use a telnet python library to send these requests? Of course, the requests will be plain strings like what you demoed in the lecture.
17. Do we have to use the GET requests or is it ok to just create a html form and display the input text?
Answer: You need to create the strings yourself. For example, you need to store headers like
“HTTP/1.1 200 OK” into your own character arrays and then send them out.

Answer: When the cilent first connects to your server, it will send a GET request. In response, your server should send back a webpage. In the TCP case, this webpage will contain a form. The client will type something in in the form and when they hit enter, the webpage should send the reply back to the server using a POST message. The server should process this post message and send back a new webpage to the client and this new webpage should display the text that was entered by the client. I hope this clarifies.
18. Is there any resource to help understand forms?
Answer: https://developer.mozilla.org/en-US/docs/Learn/Forms/Your_first_form