ورود

View Full Version : سوال: ایجاد یک تابع که هر 10 ثانیه در سمت کلاینت رفرش بشه



Azin Emami
پنج شنبه 28 اسفند 1393, 22:44 عصر
من یه پروژه دارم. کسی راه حلی برای رفرش شدن تابع هر 10 ثانیه توی یه برنامه کلاینت - سروری داره؟

میخوام تابع همزمان هم به ورودی کلاینت گوش بده و هم هر 10 ثانیه شمارنده هاش صفر بشن

اینم خود سوال :
UDP Event Counter Service
We want a simple service that receives event notifications and periodically outputs timestamped counts of each event type.
Example:
A number of named events are received:
event.type.A:1|c
event.type.B:1|c
event.type.C:1|c
event.type.A:1|c
event.type.A:1|c
event.type.B:1|c
event.type.A:1|c


The timestamped counts are output for each name:
event.type.A 4 1426209400
event.type.B 2 1426209400
event.type.C 1 1426209400



Requirements:
Events arrive as UDP datagrams.
The UDP port is configurable and defaults to 8125.
The entire content of each datagram is one event name followed by ":1|c".
Counts are output to STDOUT every N seconds.
Only the events received during the most recent N seconds are counted.
The aggregation period, N, is configurable and defaults to 10 seconds.
Timestamps are UTC unix timestamps.