服务器生成的打印打印到距离用户最近的打印机

发布于 2024-08-07 06:07:41 字数 390 浏览 3 评论 0原文

我们有一个 SAAS 应用程序,其中报告和其他打印作业在我们的应用程序服务器上生成,然后发送到 CUPS 打印队列。队列通过IP打印到客户端的打印机;到目前为止一切正常。

但是,我们对新客户提出了新要求。他们希望打印作业打印到距离当前使用的工作站最近的打印机。这是一组 8 个共享工作站,每个工作站附近有两台打印机:一台激光打印机和一台热敏标签打印机。打印机连接到网络并拥有自己的 IP 地址。它们支持 IP 打印。

由于用户进来只是选择一个开放的工作站。我们不能将打印机与用户联系起来。我们如何识别工作站并映射其附近的打印机。一旦我们识别了一个工作站,就可以创建一个数据库表,将其存储在我们可以查询的打印机附近,这很容易,但是我们如何识别工作站呢?

曲奇饼?如果他们删除所有浏览器历史记录会发生什么?还有其他想法吗?

We have a SAAS application where reporting and other print jobs are generated on our application servers and then sent to CUPS print queues. The queue prints to printers at the client sites via IP printing; so far everything works fine.

However, we have a new requirement with a new customer. They want a print job to print to the printer closest to the current workstation in use. These are a group of 8 shared workstations, each workstation has two printers near by: a laser printer and a thermal label printer. The printers are connected to the network and have their own IP address. They support IP printing.

Since a user comes in a just selects an open workstation. We can't tie printers to users. How do we identify a workstation and map its nearby printers. It's easy enough to once we id a workstation to make a database table that stored it nearby printers that we can query but how do we ID the workstation?

Cookie? What happens if they delete all the browser history? Other ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一腔孤↑勇 2024-08-14 06:07:41

如何使用此技术使用 JavaScript 获取客户端的 IP 地址,然后将其发送回服务器:

http://www.gnucitizen.org/projects/javascript-address-info/

然后,您可以将 IP 映射到 NAT 上的端口并获得唯一的映射。他实际上描述了一个与您的问题非常相似的问题。

How about using this technique to get the IP address of the client using JavaScript then sending it back to the server:

http://www.gnucitizen.org/projects/javascript-address-info/

You could then map IP to the port on the NAT and have a unique mapping. He actually describes a very similar problem to yours.

救星 2024-08-14 06:07:41

也许我误解了这一点,但是从我读到的内容来看,一旦您识别出工作站,您就可以构建附近打印机的静态地图吗?如果是这样,为什么不使用工作站的IP作为标识符呢?从 HTTP 请求中读取它应该很简单。

至于一些更奇特的解决方案。如果您的网络设置相当正式,因为附近的打印机可能共享一个公共路由器/交换机,您可以跟踪从 SAAS 服务器到工作站 (1),然后到每台打印机 (2) 的路由。然后匹配 (1) 和 (2) 并找到与最终 IP 最接近的交换机,应该会为您提供最接近的打印机。

假设工作站 A 和打印机 A 最近连接到交换机 B,而交换机 B 经过几跳连接到交换机 C,这也是连接服务器的地方。

(1) 应该看起来像这样:

Hop 1: Server IP 
Hop .....
Hop 2: Switch M
Hop .....
Hop n-1: Switch A
Hop m: Workstation A

(2) 中的其中一个路由器应该共享最后两跳

Hop n: Switch A
Hop m: Workstation A

因此,选择一台打印机,其中 mn 是最小的数字。

我当然会选择静态 IP 到打印机的解决方案,因为它很简单,但如果这不是一个选项,那么也许后者是。但这仅适用于网络设置足够大且正式的情况。

华泰
亚历克斯

Maybe I'm misunderstanding this, but from what I read as soon as you identify the workstation you can build a static map of the printers nearby? If so, why not use the IP of the workstation as an identifier. It should be straight-forward to read it from the HTTP request.

As for a bit of a more exotic solution. If your network setup is fairly formal in that those printers nearby will probably share a common router/switch, you could trace route from the SAAS server to the workstation (1) and then to each printer (2). Then matching up (1) and (2) and finding those that have the closest switch to the end IP should give you the closest printer.

So let's say workstation A and printer A are closest they are connected to switch B which over a few hops is connected to switch C and that's also where your servers are connected.

(1) should look something like this:

Hop 1: Server IP 
Hop .....
Hop 2: Switch M
Hop .....
Hop n-1: Switch A
Hop m: Workstation A

One of the routers from (2) should share the last two hops

Hop n: Switch A
Hop m: Workstation A

Therefore take a printer where m-n is the smallest number.

I would certainly go for the static IP to printer solution because it is simple, but in case that is not an option, then maybe the latter is. But this is only if the network setup is large and formal enough.

HTH
Alex

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文