LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP matters

Solved!
Go to solution

rdtttttttttttttt wrote:

Hi

 

the device is a controller card. It is the only device connected to my computer using an ethernet cable. Internally, the card is configured to have an IP address. Is there a way in LAbview to get this IP? With this info, I can then set up TCP/IP connection to the card using the found IP.

I hope there would be a solution. In windows, the moment the Card is on, It detects the connection between the PC and the device. Is there a way to tap onto that to retreive the card's IP?

 

Thank you.


If this card had ever any communication with your computer since you started it up you could query the arp cache.

 

DOS command: arp -a

 

It lists all known directly connected IP devices with their IP and MAC address.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 11 of 17
(1,529 Views)

Thanks Marton,

i never before saw this output.

 

Mike

0 Kudos
Message 12 of 17
(1,527 Views)

MikeS81 wrote:

Thanks Marton,

i never before saw this output.

 

Mike


But it means you are the listener aka server! Won't work for the discovery of devices connected to the computer.

 

Rolf Kalbermatter

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 13 of 17
(1,517 Views)

Dear Rolf,

 

You are absolutely right, but this is the way how it is usually done. You open a listener, a device connects to it, then you send the device to an other port or open a connection towards it.

 

Anyway if there is only one device connecting to your computer then you may try the bruteforce thing however it is not very nice.

0 Kudos
Message 14 of 17
(1,512 Views)

MartonLitkei wrote:

Dear Rolf,

 

You are absolutely right, but this is the way how it is usually done. You open a listener, a device connects to it, then you send the device to an other port or open a connection towards it.

 

Anyway if there is only one device connecting to your computer then you may try the bruteforce thing however it is not very nice.


Note we were mostly talking about DEVICES so far. Most times those devices are ready made. You can't easily convince a manufacturer to implement something like this to contact your application when they power up Smiley Wink

 

In fact they may power up while your application still doesn't work so what then? And how would the device know to whom to send the connection information? Looks like a catch22 to me. Or do you want to have the device send out broadcasts every few seconds to allow new applications to discover it?

 

The idea that seems best to me and that I have seen many times is the reverse approach. The device implements an UDP server on some well agreed port. One can then send an UDP broadcast with a specific format and the device recognizes this as a request to respond with a package that contains all the information necessary to connect to it. In fact the UDP Read VI itself will tell you the IP adress the response originated from so any response would suffice Smiley Wink

 

Works perfect to discover any amount of devices connected to the local network and I have seen it implemented in several products and communicated with them.

 

The fact remains that there is no standardized means in TCP/IP land to announce a service on a network automatically.

 

Rolf Kalbermatter

Message Edited by rolfk on 02-11-2009 10:49 AM
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 15 of 17
(1,504 Views)

HI

 

Thanks to everybody for your replies and suggestions. Here another issue pertaining to the same matter.

 

I figured out the device(the controller card) is using UDP to constantly send datagrams to the PC. Is a the way to tap into this datagrams, to decode the source IP(device). By using this info, I would be able to make my PC initiate comm. with device using TCP/IP functions(via the known IP)

0 Kudos
Message 16 of 17
(1,477 Views)
Solution
Accepted by topic author rdtttttttttttttt

rdtttttttttttttt wrote:

HI

 

Thanks to everybody for your replies and suggestions. Here another issue pertaining to the same matter.

 

I figured out the device(the controller card) is using UDP to constantly send datagrams to the PC. Is a the way to tap into this datagrams, to decode the source IP(device). By using this info, I would be able to make my PC initiate comm. with device using TCP/IP functions(via the known IP)


I believe you want to use the UDP Multicast Open.vi for that. This should give you the equivalent of a TCP Listener for UDP. I never have used that so I can't you help more but there should be an example in the UDP categery detailing that.

 

Rolf Kalbermatter

 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 17 of 17
(1,469 Views)