polling

API polling and timeout

非 Y 不嫁゛ 提交于 2021-02-11 08:52:06
问题 I have a polling use-case where: I want to call an API that, based on business logic, returns numbers(1-10) or error (network issue/ exception in API etc..) instantly (1.5-2 sec). If the API returns an error (network issue/ exception in API etc..) then I want to unsubscribe the polling and display error. If the API returns success, I want to check the return value and un-subscribe(if the return value is 5) or keep the polling going. I want to call API every 5 sec. I want to keep the max time

Performance cost of SetWinEventHook vs Polling in c#?

这一生的挚爱 提交于 2021-02-10 06:15:41
问题 I am developing a time tracking application, it monitors window changes and user idleness. My question is: which one costs more in terms of performance, wasting system resources: using SetWinEventHook (EVENT_SYSTEM_FOREGROUND), or setting a Timer.Tick and check if the active window title changed user32.dll GetForegroundWindow() and GetWindowText() all the time) ? For testing user idleness I already figured out that using low level mouse and keyboard hooks are more expensive than calling

Why is ZeroMQ poller not receiving messages (python)?

孤人 提交于 2021-02-08 08:24:47
问题 I'm trying to use the ZeroMQ Poller() functionality with two sockets in python: import zmq # Prepare our context and sockets context = zmq.Context() receiver = context.socket(zmq.DEALER) receiver.connect("ipc:///tmp/interface-transducer") subscriber = context.socket(zmq.SUB) subscriber.bind("ipc:///tmp/fast-service") subscriber.setsockopt(zmq.SUBSCRIBE, b"10001") # Initialize poll set poller = zmq.Poller() poller.register(receiver, zmq.POLLIN) poller.register(subscriber, zmq.POLLIN) # Process

Polling using Select function in C++ on Windows

偶尔善良 提交于 2020-07-22 09:16:21
问题 I am new in Socket Programming . I am trying to create a Application that uses Sockets for Communication. I have doubt in the Receive function because sometime it just hangs in recvfrom function. I am using select function for polling. It works when Camera is connected but If I remove Camera it doesn't show the Error Message. My Code for Polling: FD_ZERO(&m_readFds); FD_SET(Sock, &m_readFds); m_timeInterval.tv_usec = 30; //30 Microseconds for Polling m_socketLength = sizeof(m_cameraInfo); m

Continuous polling using Tasks

冷暖自知 提交于 2020-02-21 13:35:50
问题 This is something I've always used Threads / BackgroundWorker for, but am trying to migrate over to Task way of doing things. Let's say I have a 3rd party SDK I use to read bytes from a USB port. That read call is blocking and times out after 100 ms if no bytes are read, returning null. It returns immediately if bytes are read, returning byte[] array of read bytes. So I basically need to keep polling over and over, and take action on received bytes, by calling Parsing function. It's a WPF

How to poll another server periodically from a node.js server?

断了今生、忘了曾经 提交于 2020-02-04 03:23:56
问题 I have a node.js server A with mongodb for database. There is another remote server B (doesn't need to be node based) which exposes a HTTP/GET API '/status' and returns either 'FREE' or 'BUSY' as the response. When a user hits a particular API endpoint in server A (say POST /test), I wish to start polling server B 's status API every minute, until server B returns 'FREE' as the response. The user doesn't need to wait till the server B returns a 'FREE' response (polling B is a background job

Polling the right way?

僤鯓⒐⒋嵵緔 提交于 2020-01-30 14:16:10
问题 I am a software/hardware engineer with quite some experience in C and embedded technologies. Currently i am busy with writing some applications in C# (.NET) that is using hardware for data acquisition. Now the following, for me burning, question: For example: I have a machine that has an endswitch for detecting the final position of an axis. Now i am using a USB Data acquisition module to read the data. Currently I am using a Thread to continuously read the port-status. There is no interrupt

using php to monitor mysql changes **WITHOUT** polling

余生长醉 提交于 2020-01-30 08:38:32
问题 I have seen many questions similar to the one I asked. A few of them said that its ok to poll, and that doesn't affect the database performance significantly, and some are still unanswered. What I want to know is this : Can I do something similar to ASP.NET's sqldependency, which helps to find out when changes are made to the database WITHOUT polling. I know polling is ok to do, might not affect database performance, but I need to know the update as soon as it is made, so I feel I need

Apache Camel: Polling consumer

♀尐吖头ヾ 提交于 2020-01-23 17:52:05
问题 I'm new to Apache Camel and I'm trying to understand and use the Polling Consumer EIP in a simple project but I feel a little bit lost.. Could someone please help me with a little explanation or even with a little working example. Any help would be appreciated Thanks in advance 回答1: for most use cases, you can create a consumer by just defining them in the from() clause in a route... from("activemq:inbox").to(new MyProcessor()); but, you can also write your own POJO polling consumer logic for

To poll or not to poll (in a web services context)

狂风中的少年 提交于 2020-01-23 00:08:13
问题 We can use polling to find out about updates from some source, for example, clients connected to a webserver. WCF provides a nifty feature in the way of Duplex contracts, in which, I can maintain a connection to a client, and make invocations on that connection at will. Some peeps in the office were discussing the merits of both solutions, and I wanted to get feedback on when each strategy is best used. 回答1: I would use an event-based mechanism instead of polling. In WCF, you can do this