Differences

This shows you the differences between two versions of the page.

Link to this comparison view

public:howto:heartbeat [2009/04/17 03:04]
slonolom minor edits to improve readability
public:howto:heartbeat [2009/04/17 03:38] (current)
slonolom
Line 4: Line 4:
  
 For example, when sending data, onStatus is fired for each sent packet. But on slow connection that wouldn't happen too often. You can decrease sending chunk size, but it's not optimal for fast networks. When receiving data, it depends on received packets size. As you can see, this event is not ideal for calling your code periodicaly during data transfers. For example, when sending data, onStatus is fired for each sent packet. But on slow connection that wouldn't happen too often. You can decrease sending chunk size, but it's not optimal for fast networks. When receiving data, it depends on received packets size. As you can see, this event is not ideal for calling your code periodicaly during data transfers.
- 
 ===== What is heartbeat? ===== ===== What is heartbeat? =====
  
-Heartbeat is feature what allows to call your code on many places:+Heartbeat is feature that allows your code to be called back from many places:
   * during data transfers   * during data transfers
   * when you are waiting for data   * when you are waiting for data
  
-Heartbeats are periodical. If you set hearbeat to be called times in second, then if Syapse waiting for received datas 2 secodns, then heartbeat is called four times, each half of second. +Heartbeats are periodical. If you set hearbeat frequency to twice per second and Synapse spends seconds waiting for data, then heartbeat occurs four times, e.g. each half-second. 
- +===== What is it useful for? =====
-===== For what it is useful? ===== +
- +
-You can use Heartbeats for handle your GUI, for example. In some easy applications you not need to call communication in separate thread. You can made your application smooth responsible by processing of your GUI in your Heartbeat code.+
  
-Additonally, each heratbeat testing //StopFlag// too! It can made your application very fast responsible to user 'cancel' action.+You can use heartbeat to handle your GUI, for example. In a simple application, making communication calls from the main thread may freeze GUI. You can avoid that by processing GUI events in your heartbeat code.
  
 +Also, each heartbeat tests for //StopFlag//, which allows your application to instantly respond to user's //Cancel// action.
  
 ===== How to use it? ===== ===== How to use it? =====
public/howto/heartbeat.1239930268.txt.gz · Last modified: 2009/04/17 03:04 by slonolom
Driven by DokuWiki Recent changes RSS feed