Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tserver 中的一个问题 #1

Open
JasperYanky opened this issue Jun 5, 2015 · 3 comments
Open

tserver 中的一个问题 #1

JasperYanky opened this issue Jun 5, 2015 · 3 comments

Comments

@JasperYanky
Copy link

你好,非常感谢你写了这个 rep,让我获益良多
我是一个初学者,我想问下,在一个 socket 中如何找到其他的 socket 链接 实现 socket 内容的转发?

@gf0842wf
Copy link
Owner

gf0842wf commented Jun 5, 2015

简单的做法, 做一个 session和socket的映射, 如
sock =>1一个用户连接过来的socket
sock_map = {'user1': sock1, 'user2':sock2}
user1向user2发消息
服务器接收到user1的消息 data1
sock_map['user2'].sendall(data1)

@JasperYanky
Copy link
Author

还有个问题,tendpoint.py 中的EndPoint 类中 recv_data函数 读头心跳 和 读内容心跳是什么意思?

@gf0842wf
Copy link
Owner

gf0842wf commented Jun 5, 2015

请了解一下 TCP粘包 和 保活

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants