为什么 Tmux 有服务器?有什么好处? [英] Why does Tmux have a server? Whats the benefit?

查看:46
本文介绍了为什么 Tmux 有服务器?有什么好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Tmux 还很陌生,但据我所知,它使用客户端-服务器连接.

Im fairly new to Tmux but from what I've read, its using a client-server connection.

为什么有必要?仅用于管理会话吗?为什么它通过套接字而不是直接与客户端通信?

Why is that neccessary? Is that only for managing sessions? Why does it communicate through a socket rather than directly with the client?

如果有人能给我一个解释,那将不胜感激.

If anyone could provide me an explanation, that would be appreciated.

谢谢.

推荐答案

Tmux 需要一个能够在会话分离时保持进程定位的服务器.

Tmux requires a server that is able to keep located the processes when a session is detached.

如果您运行带有nohup"或disown"的进程,即使用户注销,该进程也会在后台运行,但问题是当用户再次登录时恢复对进程的控制.

If you run a process with the "nohup" or "disown" the process in going to run in background even when user logout, however the problem is to recover the control of the process when the user login again.

Tmux 服务器保持这些进程相关联,因此当您登录并且用户再次附加会话时.Tmux 服务器能够多路复用多个终端会话等.

Tmux server keep those processes associated, so when you login and the user attach the session again. Tmux server is able to MUltipleX several Terminal sessions among other things.

Tmux 的所有魔法都是由服务器完成的,但是您不必害怕 Tmux 服务器,因为 Tmux 服务器不是作为通用系统守护程序运行的,Tmux 服务器是从用户空间单独启动的,并且当没有分配用户会话时,Tmux 服务器会自动停止自身,这就是为什么当您键入tmux ls"并且先前未创建会话时会显示消息无法连接到服务器:连接被拒绝"的原因(服务器不是正在运行,特此拒绝连接)

All the magic of Tmux in made by the server, but you don't have to be afraid of Tmux server because, the Tmux server is not running as a general system daemon, the Tmux server is launched from the userspace individually, and when not user sessions are allocated Tmux server automatically stop itself, this is the reason why when you type "tmux ls" and sessions were not previously created the message "failed to connect to server: Connection refused" is displayed (The server is not running, hereby connection is refused).

这篇关于为什么 Tmux 有服务器?有什么好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆