You are not logged in.

#1 2006-03-13 18:53:05

RaLX
Member
Registered: 2005-10-17
Posts: 54

What is more memory/cpu time consuming?

I'm writing a program in Java that needs to maintain communication with some 30 pc's (and maybe more in future) but with small packages (below 1-2 Kb). My program needs to know when one comp goes offline without send any notice (if crash for example) so I think that I have two options:

1) If I use UDP datagrams it's more convenient for faster communication, but I think that I'll need to check every amount of seconds If all PC's are still online.
2) If I use TCP sockets, I can know more easily if a PC goes offline because of broken TCP connection, don't?, or I still need to check?.

Anyone can help me to know what it's more memory and cpu time consuming between use UDP Datagrams and TCP sockets in this case?, or if I'm totally wrong or even if there's a better solution  roll .

Offline

#2 2006-03-13 19:53:25

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: What is more memory/cpu time consuming?

What you're doing is typically called a 'heartbeat' - it's very common.  You can google that if it helps.

I think the last time I implemented any sort of heartbeat message it was over tcp, because tcp has guarenteed delivery (you don't want alarms going off due to a lost udp packet).

Either one is not going to affect memory/cpu usage as it's all I/O.

Offline

#3 2006-03-13 20:59:16

RaLX
Member
Registered: 2005-10-17
Posts: 54

Re: What is more memory/cpu time consuming?

Thanks!  smile I'll take in consideration about TCP using and google more about it .

Offline

Board footer

Powered by FluxBB