471,310 Members | 1,378 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

TCP Listener

Hello everybody!

I am trying to write a little piece of code that would receive some
data over the network from an alarm system device. The device sends data
with a defined data packet structure. The software should listen 24 hour a
day. Is there a better way than creating a thread with listener that awaits
for a connection?

Thanks in advance!

Marino
Jul 31 '08 #1
9 1849
Does that Alarm system device supports notification service? If it
supports notification the task could be made easier.
Thanks and Regards,
ArunDhaJ
Jul 31 '08 #2
It just broadcasts events... I don't know about notification service.
How could it be done with that?

Thnaks
Marino

"ArunDhaJ" <ar******@gmail.comwrote in message
news:76**********************************@k36g2000 pri.googlegroups.com...
Does that Alarm system device supports notification service? If it
supports notification the task could be made easier.
Thanks and Regards,
ArunDhaJ

Jul 31 '08 #3
I suspect the term which u use as "Broadcast events" is same as
"Notification".

Instead of creating a thread which continuously polls the device to
check whether an alarm being raised, you could create a thread which
waits for broadcast event. Upon receiving the event the code should
further proceed.

Regards
ArunDhaJ
Jul 31 '08 #4
Instead of creating a thread which continuously polls the device to
check whether an alarm being raised, you could create a thread which
waits for broadcast event. Upon receiving the event the code should
further proceed.
Well, that is the way I stated in the beginning, but I was wondering if
there is some
other way of receiving the broadcasted event other than continuously
listening on some port.

Thanks
Marino
Jul 31 '08 #5
On Jul 31, 5:42*am, "Marino" <mar...@dir.hrwrote:
Hello everybody!

I am trying to write a little piece of code that would receive some
data over the network from an alarm system device. The device sends data
with a defined data packet structure. The software should listen 24 hour a
day. Is there a better way than creating a thread with listener that awaits
for a connection?

Thanks in advance!

Marino
Hi,

not really (at least in the above scenario), what is wrong with that?
just create a windows service that does that.
Jul 31 '08 #6
On Jul 31, 7:28*am, ArunDhaJ <arund...@gmail.comwrote:
I suspect the term which u use as "Broadcast events" is same as
"Notification".

Instead of creating a thread which continuously polls the device to
check whether an alarm being raised, you could create a thread which
waits for broadcast event. Upon receiving the event the code should
further proceed.
I think it's the other way around, is the device the one that send the
notification, his app. will only sits idle waiting for a network
connection
Jul 31 '08 #7
On Thu, 31 Jul 2008 02:42:02 -0700, Marino <ma****@dir.hrwrote:
Hello everybody!

I am trying to write a little piece of code that would receive some
data over the network from an alarm system device. The device sends data
with a defined data packet structure. The software should listen 24 hour
a
day. Is there a better way than creating a thread with listener that
awaits
for a connection?
Does the device require the use of TCP? If so, then setting up a listener
(whether with an explicit thread, or using an asynchronous call) is your
requirement.

If the device supports UDP, then it's possible you'd find that to be a
useful alternative, albeit possibly more complicated if you have to also
ensure that the notification was received (the device would have to expect
some sort of acknowledgement and keep resending the notification until it
receive that).

Either way should work fine.

Pete
Jul 31 '08 #8
It requires TCP.

Thank you and everybody for answers!!

Marino

"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Thu, 31 Jul 2008 02:42:02 -0700, Marino <ma****@dir.hrwrote:
>Hello everybody!

I am trying to write a little piece of code that would receive some
data over the network from an alarm system device. The device sends data
with a defined data packet structure. The software should listen 24 hour
a
day. Is there a better way than creating a thread with listener that
awaits
for a connection?

Does the device require the use of TCP? If so, then setting up a listener
(whether with an explicit thread, or using an asynchronous call) is your
requirement.

If the device supports UDP, then it's possible you'd find that to be a
useful alternative, albeit possibly more complicated if you have to also
ensure that the notification was received (the device would have to expect
some sort of acknowledgement and keep resending the notification until it
receive that).

Either way should work fine.

Pete

Aug 1 '08 #9
"Marino" <ma****@dir.hrwrote in message
news:g6**********@ss408.t-com.hr...
It requires TCP.
TCP doesn't do broadcasts.
>
Thank you and everybody for answers!!

Marino

"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
>On Thu, 31 Jul 2008 02:42:02 -0700, Marino <ma****@dir.hrwrote:
>>Hello everybody!

I am trying to write a little piece of code that would receive some
data over the network from an alarm system device. The device sends data
with a defined data packet structure. The software should listen 24 hour
a
day. Is there a better way than creating a thread with listener that
awaits
for a connection?

Does the device require the use of TCP? If so, then setting up a
listener (whether with an explicit thread, or using an asynchronous call)
is your requirement.

If the device supports UDP, then it's possible you'd find that to be a
useful alternative, albeit possibly more complicated if you have to also
ensure that the notification was received (the device would have to
expect some sort of acknowledgement and keep resending the notification
until it receive that).

Either way should work fine.

Pete

Aug 2 '08 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by UNIXNewBie | last post: by
6 posts views Thread by Steve Teeples | last post: by
reply views Thread by Blake | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.