06-18-2009 12:08 PM
Hello,
I am working with an application based on the tcp/ip communication subvi´s. The problem is, when the server is waiting for any connected unit, the computer is using the 100% of its resources. I think this is not a good option, even more for my case, in which I have more than 15 listeners working at the same time. That makes the computer to work really slow.
Does anybody know if there is any way to do a "passive listening", waiting for any event (visiting the port every some time) to start the communication? Right now, the computer is continiously listening in 20 different ports, which spends a lot of the computer resources.
Your suggestions are highly appreciate.
Thanks in advance.
jm
06-18-2009 02:48 PM - edited 06-18-2009 02:48 PM
Hi jmhf,
can you show your vi? I never saw such a behaviour. Are you sure that all of your listeners are started without an error? Maybe one of your ports is already in use, then it could be that you run your loop as fast as possible, because your function will not be executed.
Mike
06-18-2009 02:58 PM
Hi again,
I do not have the code here. Tomorrow morning, from the office, I will post it.
Anyway, the problem comes from the "Listen.vi" subvi, which keep executing until it gets any connection. This execution spends a 100% of the computer resources. This subvi has a timeout input, which has a "-1" default value. This means no timeout at all, that is to say, an infinite valu, continuously listening. Is there any way just to listen when any computer connects?
jm
06-19-2009 05:07 AM
Here you have a part of the code. I havejust one connection working, one port listening, but the complete computer resources are used (100%) while executing TCPIP listen.vi.
Thanks in advance
jm
06-19-2009 08:42 AM
Hi jmhf,
i can't see this behaviour with your vi. Did you check if you get an error? Do you really have the 100% cpu usage if the "TCP Listen.vi" waits for a connection?
Mike
06-19-2009 09:50 AM
I too am not seeing the problem you described. Is it possible you have a firewall or other security software running on your machine that's causing some sort of interference when you try to open a port for listening?
Also, unrelated, there's absolutely no reason to be using local variables for your timeouts. Just wire the block diagram terminal directly.
06-21-2009 10:26 AM
Hi again,
all of you were right, this works properly. The problem was not this part of the sofware, but another while loop running at the same time. thanks to everybody for your help, and sorry for make you to lose your time.
jm