-
Notifications
You must be signed in to change notification settings - Fork 7
Session 9: Practice 2

- Time: 2h
- Date: Wednesday, Feb-26th-2020
-
Goals:
- Practicing with the creation of clients
- More Practicing on creating classes and objects
- Learn how to run servers and clients on the same machine
- Get familiar with the typical socket and network errors that will occur
The goal of this practice is to gain experience running servers and clients in the same computer. We will develop python programs (clients) that send messages and sequences to other servers
For making it easier to send the messages, we will develop the class Client located in the Client0 module (File Client0.py)
| Method | Parameters | Return | Description |
|---|---|---|---|
| __init__(ip, port) | IP: String, Port: Integer | None | Object Constructor. Stores the IP and Port values inside the object |
| __str__() | none | String | It returns the string: "Connection to SERVER at {ip}, PORT: {port}", where the {ip} and {port} are the server's ip and port respectivelly |
| ping() | None | None | It just prints the "OK" message on the console. It is just for testing the module |
| talk(msg) | msg: String to send to the server | The response message from the server | It creates a new socket, connects to the server, sends the message, receive the response message from the server and closes the socket |
| debug_talk(msg) | msg: String to send to the server | The response message from the server | It works the same than the talk method, but it prints on the console both the message sent to the server and the response received, in different colors |
As always, this class will be created step by step in the exercises. The process is guided
We will implement the Client Class and develop some example programs to test it against the server
- Filename:
- Description:
- TODO
- Modulo client: funcion send. Make the module work with simple strings
Change the server so that only the receive message is shown... (in a different color)
- Open a sequence from a file (ADA or whatever), calculate its complement, divide it into pieces of 20 bases and send to the server....
- Open all the genes and send them to the server
- Launch two servers. Open a gene. Read 20 bases. If the initial base is 'A' or 'T' is sent to the server 1, if the base is 'C' or 'G' it is sent to the other server
The session is finished. Make sure, during this week, that everything in this list is checked!
- You have all the items of the session 6 checked!
- Your working repo contains the P1 Folder with the following files:
- Ex1.py
- Ex2.py
- Ex3.py
- Ex4.py
- Ex5.py
- Ex6.py
- Ex7.py
- Ex8.py
- Ex9.py
- Ex10.py
- Seq0.py
- All the previous files have been pushed to your remote Github repo
- Juan González-Gómez (Obijuan)

- Alvaro del Castillo. He designed and created the original content of this subject. Thanks a lot :-)

S0: Introduction
S1: Tools I
S2: Tools II
S3: Practicing with the tools
S8: Client-Server-1
S9: Client-Server-2
S10: Client-server-3
S11: Client-server-4
S12: HTTP protocol-1
S13: HTTP protocol-2
S14: HTTP module
S15: HTTP module
S16: HTML forms
S17: HTML forms