聊天软件基础--即时通信工作原理

聊天软件基础–how instant message work

这里instant message是正真的即时,不支持离线

  • You go to the download page and get a copy of the free software client for your computer.

  • You install the software and open the client.

  • The client tries to connect to the server. It uses a proprietary protocol for communication.

  • Once the client is connected to the server, you can enter your name and password to log in to the server. If this is your first time on, you can sign up for an account and immediately begin using it. When the server verifies your name and password, you are logged in.

  • The client sends the server the connection information (IP address and number of the port assigned to the client) of the computer you are using. It also provides the user with the names of everyone in your contacts list.

  • The server creates a temporary file that has the connection information for you and the list of your contacts. It then checks to see if any of the users in your contact list are currently logged in.

  • If the server finds any of your contacts logged in, it sends a message back to the client on your computer with the connection information for that user. The server also sends your connection information to the people in your contact list that are signed on.

  • When your client gets the connection information for a person in your contact list, it changes the status of that person to “online.” You click on the name of a person in your contact list who is online, and a window opens that you can enter text into. You enter a message and click “send” or hit return to communicate with that person.

  • Because your client has the IP address and port number for the computer of the person that you sent the message to, your message is sent directly to the client on that person’s computer. In other words, the server is not involved at this point. All communication is directly between the two clients.(server 有点类似地图,他有你的source和destination,然后规划路线)
  • The other person gets your instant message and responds. The window that each of you sees on your respective computers expands to include a scrolling dialog of the conversation. Each person’s instant messages appears in this window on both computers.

  • When the conversation is complete, you close the message window. Eventually, you go offline and exit. When this happens, your client sends a message to the server to terminate the session. The server sends a message to the client of each person on your contact list who is currently online to indicate that you have logged off. Finally, the server deletes the temporary file that contained the connection information for your client. In the clients of your contacts that are online, your name moves to the offline status section.

转载

­

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值