... | ... | @@ -129,7 +129,7 @@ For communicating with a program that is running in another computer we use **so |
|
|
|
|
|

|
|
|
|
|
|
The idea behind the **sockets** is similar, but instead of opening a local file, it opens a *channel* to communicate with the remote program. The socket **0is an object**, and as such, it has **properties** and **methods** for managing the communication channel.
|
|
|
The idea behind the **sockets** is similar, but instead of opening a local file, it opens a *channel* to communicate with the remote program. The socket **is an object**, and as such, it has **properties** and **methods** for managing the communication channel.
|
|
|
|
|
|
Each application that is willing to communicate with the outer world should do the following:
|
|
|
|
... | ... | @@ -163,7 +163,7 @@ The `nc` command only allows the connection of 1 client to the server. So that o |
|
|
|
|
|
### Teacher's server
|
|
|
|
|
|
For programming our **first client** we need a server to connect to. This is the purpose of the **Teacher's server**. It will be running on the **Teacher's computers** so you can test your clients. Once you learn how to do it, you can launch the server in your own computer.
|
|
|
For programming our **first client** we need a server to connect to. This is the purpose of the **Teacher's server**. It will be running on the **Teacher's computer** so you can test your clients. Once you learn how to do it, you can launch the server in your own computer.
|
|
|
|
|
|
* This is the **code** of the **Teacher's server**. Do not worry if you don't understand this code yet. You will have time for that.
|
|
|
|
... | ... | @@ -250,7 +250,7 @@ import socket |
|
|
# SERVER IP, PORT
|
|
|
# Write here the correct parameter for connecting to the
|
|
|
# Teacher's server
|
|
|
PORT = 8080
|
|
|
PORT = 8081
|
|
|
IP = "192.168.124.179" # it depends on the machine the server is running
|
|
|
|
|
|
|
... | ... | @@ -330,7 +330,7 @@ The first column is for your computer in the lab and/or your mobile. The second |
|
|
|
|
|
You can also get the IP of your phone when you reach **home**. And also, take note of your mobile IP when you reach the LAB next date. Write down all the IPs in the table.
|
|
|
|
|
|
### Exercise 2
|
|
|
### Exercise 2 (to do at home)
|
|
|
|
|
|
* **Filename**: S08/e2.txt
|
|
|
|
... | ... | |