English 中文(简体)
Can 我利用同步的方案拟订来收集服务器的数据?
原标题:Can I use asynchronous programming to fetch data from a server?

This is my situation: I have a account (userid/password) to communicate with an airline central reservation system through their API. The API provide methods to connect, disconnect, sign in, signout, sendcommand and getdatareturn.

这是我依次获得通缉数据的步骤。

  1. Connect to host
  2. sign in to system
  3. send a command to get a list of passergers of a flight at a specified date from a city to another city (LD command with some parameter like flight no, flight date, pair of city for original and destination), but in this step, the host only return a part of the full list (for example, it return only 20 passengers and end of this list is a # character to signal that there are more) if I want a full list, I must send another command (MD command) to move down and so on to the end of list (with the signal by the END string) .The passenger list content passenger name, class and a PRN code, base on these PNR code, I must send another command to get details passenger information like fullname, itinerary, contact information ... then process it (this consume some time to do)(and in this details, I can send various command to get more information...)
  4. sign out of system
  5. disconnect from host

我能否将多面或平行的技术用于第3号,从服务器获取数据?

最佳回答

取决于连接类型。 你们是如何联系的,你是否继续联系?

如果它拥有一个能够保持沟通的袖珍(即国家),那么你可以尝试建立另一个联系,重新记录,并请求提供你想要的数据。 如果它利用某种会议身份证明使随后的要求相互挂钩,就会造成无国籍状态(例如,对于吉大港山区而言),你可以同时向同一届会议发出多重要求,并且看看这是否可行。

因此,通过你最初的联系,你要求获得国家情报和安全局的名单,然后利用这一联系和新的联系,要求当时多位乘客提供乘客数据,同时获得名单上所有乘客的所有数据。

如果要实现这两项选择都不会奏效,而且你又不愿意使用一种联系,我恐怕没有其他解决办法。 你们能否试图与他们联系,以问能否做到这一点?

问题回答

我害怕我的回答是“它取决于”。 我看不出客户方面的平行询问有任何问题,有些信息(如旅客详细情况)可能以单独、平行的方式处理,但把全部清单看齐,如同在一对面/上进行。

为什么我不了解你询问的系统,但是,它是否拯救了你的问答状态(他要求的是,名单上的距离目前是他要求的),因此很可能不能很好地处理名单上的“我第1、第2和第3部分”,特别是如果第3部分确实存在的话(如果你看看看看看看看第2部分的“第”部分,你不知道)。

Can I use multithread or parallel techonology for #2 to get data from server?

它能发挥什么作用?

在数据归还之前,你不能脱离系统,最后两个步骤当然不是资源密集型的,或者取决于你的用户界面。

What you actually want to do, sending the command more then once, is not really a task for multiple threads. You simply want to send the command until the symbol that indicates there isn t additional data is not detected.

如果你还没有这样做,那就意味着你应该这样做。

这样,在青少年应用中,对用户的投入就没有什么不同。

也许,如果《减贫战略文件》允许同一个《公约》的多重联系,你可以同时使用平行行动,使用户能够同时发出不止一个疑问。 例如,用户在屏幕上可能有一个以上的电离层扰动表,因此同时处理不止一个电离层,例如不同日期、机场、飞行和轴心。

正如其他海报所指出的,如果用户当时只处理一个询问,那么就没有多少点可以同时处理任何问题(除了《国际调查》和客户协议之外,这样,国际调查组不会被锁定,因此可以取消询问)。

尽管如此,鉴于这一要求,我通常会以这样的方式设计,即多问是违约行为。 我要问一下的是,如果有必要/可能的话,如果服务器支持的话,两种形式的表格就可以同时提出两个问题。 这比采用两个进程更灵活。





相关问题
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. ...

热门标签