English 中文(简体)
3. 建立客户服务器窗口应用程序
原标题:building client-server windows application

正在尝试使用:

c# , MySql Server

该设想已经过时,即有两个常设计算机(客户)与另一个常设计算机(服务器)连接。

如下文所示:“entergraph

my questions :

  1. how to show live data in both clients when one change a table , the view will changed at the another PC

  2. 如何建立管理客户获得共有资源(db)的方法,防止错误——

    编辑: i 不需要一部源代码,只是需要走路穿越公路。

问题回答

选择两种广泛的方法。

1) Have each client periodically poll the server for updates. Not recommended but easy to implement.
2) Have the server notify the clients of changes. Much more efficient but can be tricky to implement.

通知客户其他客户的变动情况:

  1. Aside from your connection threads you should store references to all currently connected clients, in some kind of synchronized collection (to make sure there are no race conditions).
  2. Now, if any client commits any changes, the server iterates over the other clients and notifies each of them about the change, either with a "Entity X has changed, you should load it again" message or by just pushing the updated entity to the client, hoping that the client will react accordingly.
  3. If you use the first approach, the client now has the choice of either loading the updated entity or load it when it is accessed the next time. The second approach will enforce the client to cache the data (or not, since the client may just cache the ID and reload the entity at another time as if the server just notified it about the update, like in the first approach).

如果你(无论出于何种原因)不能相信你数据库的并行准入安全,你就应当使用像一个单一阅读的任务问题(最简单的情况是......)这样的内容。 采用更为优化的办法,可以同时阅读行动并排列优先次序,但执行方式是 / 疼痛”。

首先,你可能想考虑一个与客户和亚洲开发银行(ASP?,COM?,Custom Built?)互动的中层。 否则,个人客户很可能需要时间,才能在行经更新后检查。

AFA the sharing issue, it is a database. Databases are designed for concurrent access, so.... not sure about the error part. I you are using c#, and really worried about, ADO.NET has "pesimistic" mode to connect to the DB, but at the cost of performance.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...