LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time out tcp ip open connection

Hello !
 
I have make a sub-VI which search the IP address. For that i ask the user to give the 3 first numbers of the network. I concatenate the last number with the index of a for loop. I give all at an "open TCP IP connection"(time ou 20 ms), and with it status and a true/false loop, i keep the address or no.
When i am in debug mode, i don't have problem, but when i am in normal mode, the sub-VI don't find the address. To be exactly, it find nothing.
If somebody has an oter solution ? or an answer ?
thanks a lot
"We are the knight who said "NI" !"
Monthy Python, sacré graal
0 Kudos
Message 1 of 13
(3,803 Views)

From the way you describe it, it's not exactly clear what you mean. If by "debug mode" you mean highlight execution, then this is almost certainly a timing issue. Apparently 20 ms is simply not enough time for whatever is on the other side of your connection to answer. When you use highlight execution, the timeout you wire into the TCP Open Connection is apparently ignored.

The solution to this would be either to increase the timeout, make sure the other side can react fast enough or use another method. For example, you can have the other side broadcast its IP address through UDP, which will allow you to read it using the UDP VIs.

If this didn't help you, you should post your code (including the code of the server).


___________________
Try to take over the world!
0 Kudos
Message 2 of 13
(3,795 Views)
Yes, i thinked it was about the time out, but i have put a "wait" functiun (60 ms) in the loop and reduce the number of Address to scan  (just 10) with that it find the Address IP of the device, but when i change the number of address to scan (20), it don't find the device.
I don't think it about the time out
"We are the knight who said "NI" !"
Monthy Python, sacré graal
0 Kudos
Message 3 of 13
(3,788 Views)
I don't have LV 8, so I can't look at your code, but it sounds like your timing problem is on the server side - for instance, that the server is not listening when you're opening your connection. As I said, from the description it sounds like the best solution is to use UDP to do the identification.

___________________
Try to take over the world!
0 Kudos
Message 4 of 13
(3,785 Views)

I can't use UDP because i need to now the IP.

The objective of my sub VI is to know which address is connected on my network. It's for that i ask each address. I have tried with and empty string to IP but it give me the IP address of me computer.

thanks a lot for reply

"We are the knight who said "NI" !"
Monthy Python, sacré graal
0 Kudos
Message 5 of 13
(3,781 Views)
What I meant was that you use a UDP multicast to publish the IP address of the server (let's say once a second) and then use that IP address with the TCP VIs. That would probably be the best solution, because you would get the address immediately. Look at the UDP multicast examples to see how.
 
If you don't want to do that, then a better way of doing what you did would probably be to use a while loop instead of a for loop (and to stop it when there is no error) and to use the quotient and remainder VI to iterate through all the addresses in your subnet. In any case, you will need to handle that timing problem, which can be either in the server or the client. I can't say that I see anything terribly wrong with the image you posted (other than the fact that 20 ms might not be enough), so the problem might be with the server.

___________________
Try to take over the world!
0 Kudos
Message 6 of 13
(3,774 Views)
Thanks for you answers,
 
but i have change the time out ( 1 second) but it don't change something, What i don't understand, it when i scan 10 address, i don't have this problem, but when i scan 20 address or more i have this problem. Maybe it is not from the time out, maybe something is too speed ?
  
"We are the knight who said "NI" !"
Monthy Python, sacré graal
0 Kudos
Message 7 of 13
(3,767 Views)

As I already said, I think the problem might be with the server (for example, if the server gets "stuck" for some reason if you're opening connections too many times to quickly). Without seeing the code for it, though, I have no way of knowing what the problem is.

In any case, you already know my suggestion (use UDP multicast to publish the IP address).


___________________
Try to take over the world!
0 Kudos
Message 8 of 13
(3,760 Views)
Is the port of other computer the same that the port you want  to open?
Manuel R
AE dans une autre vie
0 Kudos
Message 9 of 13
(3,733 Views)
Do you detect if port are opened?
Manuel R
AE dans une autre vie
0 Kudos
Message 10 of 13
(3,728 Views)