简体   繁体   English

VB.net,连接到我的主应用程序的客户端应用程序

[英]VB.net, client app that connects to my main app

I was unsure how to word this in order to search for it. 我不确定如何用词来搜索它。

What I have is an Automated Control Center for the company I work for that runs on a Windows Server 2012 VM. 我所拥有的是我所在公司的自动控制中心,该中心在Windows Server 2012 VM上运行。 This app that I created (that I incorporated several of the previous programmer's apps into it) connects to several SQL tables and updates information from data that is provided via sever other in-house vb apps as well as our main ERM application that handles orders, inventory, BOMs, etc for each item our company sells. 我创建的这个应用(我将以前的几个程序员的应用合并到其中)连接到多个SQL表,并从通过其他内部vb应用以及处理订单的主要ERM应用提供的数据中更新信息,公司出售的每件商品的库存,BOM等。

I created my own windows notification pop-up (completely from scratch because for some reason in Windows 10 since last update the normal call to notification pop-up is not creating a pop-up... plus my pop-up [which looks identical in form and function to the standard windows 8 - 10 pop-up] also has a pin it function to hold the notification on screen indefinitely) 我创建了自己的Windows通知弹出窗口(完全从头开始,因为自从上次更新以来在Windows 10中出于某种原因,对通知弹出窗口的常规调用未创建弹出窗口...加上我的弹出窗口[外观相同在形式和功能上与标准Windows 8-10弹出窗口相同]也具有固定功能,可将通知无限期地保存在屏幕上)

The reason for this is because on my notification pop-up, I have indicator checkboxes that switch light graphics that go green, yellow, orange, red indicating the status of the different modules that need to be running and connecting and processing the facets of the business that keep us in business. 原因是因为在我的通知弹出窗口中,我有一个指示器复选框,用于切换亮绿色,黄色,橙色,红色的指示灯图形,指示需要运行的不同模块的状态以及连接和处理模块的各个方面。保持我们业务往来的业务。

Currently I have to be remote logged into the Windows Server VM to monitor this "monitor" (I made the pop-up a pin in place so I could minimize the main form and just glance at this to make sure it is running) 当前,我必须远程登录Windows Server VM来监视此“监视器”(我将弹出窗口固定在适当的位置,这样我可以最小化主要窗体并仅查看一下以确保其正在运行)

The reason I have to monitor it is because the previous programmer (the guy I took over for) did not put proper data validation on the other clients and user's can sometime slip garbage data through to the processor which then craps out and then I need to troubleshoot it and get whatever module running again. 我必须监视它的原因是因为以前的程序员(我接任的那个人)没有在其他客户端上进行正确的数据验证,并且用户有时可以将垃圾数据滑入处理器,然后清除掉,然后我需要对它进行故障排除并重新运行任何模块。

So, now to my actual question... 所以,现在我的实际问题是...

I want to make another app that connects to this one in some way (either directly through sharing of a xml/text file or tcp/ip) that would look identical to my notification form that would sit on my pc and allow me to monitor this program so I do not have to remote into the VM. 我想制作另一种以某种方式(直接通过共享xml /文本文件或tcp / ip共享)连接到此应用程序的应用程序,该应用程序看起来与我位于PC上的通知表单相同,并允许我监视此应用程序程序,所以我不必远程进入虚拟机。

I'm not specifically asking for anyone to write me this code, but I have had thoughts on what direction I might want to proceed, but was looking for more expert opinions on how to proceed (saving me some trial and error and thus reducing wasted time and headaches) if anyone has attempted such a thing and can guide me. 我并没有特别要求任何人为我编写此代码,但我已经对我可能要朝哪个方向进行了思考,但我正在寻找有关如何进行的更多专家意见(为我节省了一些反复试验,从而减少了浪费时间和头痛),如果有人尝试过这种事情并且可以指导我。

So, this main app uses the settings.settings file to store variable data as well as several local and off-site SQL database tables to store business related data. 因此,此主应用程序使用settings.settings文件存储变量数据,以及几个本地和异地SQL数据库表来存储与业务相关的数据。

I was thinking of generating a file that had pertinent info about the status of each module and then having a client read from it (this would also allow me to store that file on our webserver and access it off-site without punching a hole in our firewall to allow it to connect to the main program) 我当时正在考虑生成一个文件,该文件具有有关每个模块状态的相关信息,然后让客户端读取该文件(这也使我可以将该文件存储在我们的网络服务器上,并可以在不打孔的情况下从现场访问该文件防火墙以使其可以连接到主程序)

So this is more like me asking if anyone has any better thoughts on this. 所以这更像我在问是否有人对此有更好的想法。

I have a couple thoughts: 我有几点想法:

  • Using a file to transfer information to different clients is BAD , you run in to file locking issues and can easily cause more problems then if you just created it right in the first place. 使用文件将信息传输到不同的客户端是BAD ,您会遇到文件锁定问题,如果只是一开始就创建文件,则会很容易导致更多问题。

So the next part depends on if the information is still valid if its "old". 因此,下一部分取决于信息的“旧”信息是否仍然有效。 I do this kind of thing in two ways 我以两种方式做这种事情

(if you don't care about information that you missed or is old, which doesn't really sound like you) (如果您不在乎丢失或过时的信息,听起来似乎并不像您一样)

  • I broadcast status messages with a UDP stream, then have whatever client listening for that and do stuff. 我用UDP流广播状态消息,然后让任何客户端侦听并执行操作。 Sometimes it misses things if my computer is off or the network connect has problems but I don't care about that when I do it like this 有时,如果我的计算机关闭或网络连接出现问题,它会丢失某些信息,但是当我这样做时,我并不在乎

(the "better way") (“更好的方式”)

  • I create a webservice, have the server post everything to the webservice and give it an ID, then I have clients that check that webservice for "new" messages, everytime the client gets a message the webservice marks it as read and doesn't return that message in the list of messages in the future. 我创建了一个Web服务,让服务器将所有内容发布到该Web服务并给它提供一个ID,然后让客户端检查该Web服务中是否有“新”消息,每当该客户端收到一条消息时,该Web服务会将其标记为已读并且不返回将来在邮件列表中显示该邮件。 This takes a little more work and requires you to be able to add code to the server (so it can "post" to the webservice) but it has the added benefit of working "anywhere" if you publish the service to the internet. 这需要花费更多的工作,并且要求您能够向服务器添加代码(以便它可以“发布”到Web服务),但是如果将服务发布到Internet,它还具有在“任何地方”工作的额外好处。

Thinking about it, I think I came up with a solution (unless someone has a better way [within the same level of complexity or less]) 考虑一下,我想我想出了一个解决方案(除非有人有更好的方法[在相同或更少的复杂度内)

I will add to each update of the controls on the form (which already updates a variable for each object on the notification form (this was because the main modules run on a background thread) 我将添加到表单上控件的每次更新(该更新已经为通知表单上的每个对象更新了一个变量(这是因为主要模块在后台线程上运行)

The notification pop-up gets refreshed on the cycle timer that runs for the main program that runs in the same thread as the main form GUI. 通知弹出式窗口在为与主窗体GUI相同线程中运行的主程序运行的循环计时器上刷新。 As this timer runs it causes the notification form to check the status of each of the variables that are updated from the background thread as far as what stage it is in and what is running/not running, etc. 在运行此计时器时,它会导致通知表单检查从后台线程更新的每个变量的状态,包括处于哪个阶段以及正在运行/未运行的状态等。

So I will just expand on that and update a text file with this information that the client program will read and display. 因此,我将对此进行扩展,并使用客户端程序将读取和显示的信息更新文本文件。

OR I might just have it create another small table in the already existing SQL database that the client can read from. 或者我可能只是让它在客户端可以从中读取的现有SQL数据库中创建另一个小表。 Probably better that way, though our running joke is based on the fact that the previous guy loved to use tables for storing EVERYTHING that included variables for the program itself. 尽管我们开玩笑是基于这样一个事实,即前一个家伙喜欢使用表来存储包含程序本身变量的所有内容,但这种方式可能更好。

I really don't want to rely on creating a VPN to tunnel into the environment here, nor creating an exception in our firewall to allow this program access via tcp/ip or udp protocols on hindsight. 我真的不想依靠创建一个VPN来进入这里的环境,也不想在我们的防火墙中创建一个例外以允许事后通过tcp / ip或udp协议访问此程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM