Jump to content


Photo
* * * - - 1 votes

TCP \ IP Queries


  • Please log in to reply
6 replies to this topic

#1 prash

prash

    I want a LabVIEW icon under my name!

  • Members
  • 3 posts
  • Version:LabVIEW 8.6
  • Since:2008

Posted 19 August 2009 - 07:59 AM

Hi All,

I want to develop a simple pc messenger application using TCP\IP protocol. I want to send a broadcast message to all the systems connected on LAN how can i do it and also how can i get all the IP address os all systems on LAN

#2 PaulL

PaulL

    Extremely Active

  • Premium Member
  • 462 posts
  • Location:Flagstaff AZ
  • Version:LabVIEW 2011
  • Since:1997

Posted 19 August 2009 - 04:48 PM

Are all the applications using the messages LabVIEW applications? If so then I think the simplest and quickest way to implement this is to use networked shared variables. These allow you to use a publish-subscribe protocol. (You said you wanted to broadcast the message.)

If you just have one message you write periodically you could use just the TCP/IP primitive VIs in a loop to write the same message to each recipient. (Or you could use UDP to broadcast.)

There is also a Simple Messaging Reference Library (STM) available. Personally I think these can give you a good idea of how things should work, but I don't know why anyone would use them instead of shared variables (since these already do the work for you).

#3 Christian_L

Christian_L

    Very Active

  • NI
  • 64 posts
  • Location:Austin, TX
  • Version:LabVIEW 2010
  • Since:1993

Posted 19 August 2009 - 04:58 PM

Hi All,

I want to develop a simple pc messenger application using TCP\IP protocol. I want to send a broadcast message to all the systems connected on LAN how can i do it and also how can i get all the IP address os all systems on LAN

TCP does not support broadcasting as it requires a connection for each communication link, however UDP does allow for broadcasting to all systems on the local subnet. Each system listening just needs to open a UDP port at a known port number, and then you can broadcast a message using UDP to that given port number. (Send the UDP message to 255.255.255.255 for broadcasting.) You can send out a Discover or Ping message so that each system listening responds to the sender with its name and IP address. This wil provide a list of available systems to the sender.

You can check out the Asynchronous Message Communication (AMC) reference library which handles most of what you are asking for. It includes a Ping function which will discover all of the systems on the network which have the AMC listener enabled. This allows you to get a list of devices on the network so that you can send directed messages to each.
Christian Loew, CLA
Senior Systems Engineer, Industrial Embedded - National Instruments

There's a reference design for that.

#4 Mark Yedinak

Mark Yedinak

    Extremely Active

  • Premium Member
  • 422 posts
  • Location:Huntley, IL
  • Version:LabVIEW 2011
  • Since:1997

Posted 19 August 2009 - 07:16 PM

TCP does not support broadcasting as it requires a connection for each communication link, however UDP does allow for broadcasting to all systems on the local subnet. Each system listening just needs to open a UDP port at a known port number, and then you can broadcast a message using UDP to that given port number. (Send the UDP message to 255.255.255.255 for broadcasting.) You can send out a Discover or Ping message so that each system listening responds to the sender with its name and IP address. This wil provide a list of available systems to the sender.

You can check out the Asynchronous Message Communication (AMC) reference library which handles most of what you are asking for. It includes a Ping function which will discover all of the systems on the network which have the AMC listener enabled. This allows you to get a list of devices on the network so that you can send directed messages to each.


If you use UDP and broadcasting you need to be aware that most switches will restrict UDP broadcasts to a single subnet. If you are in an environment where you may have multiple subnets the UDP broadcast scheme may not work in this environment. This has nothing to do with LabVIEW but rather how most networks and switches are configured.
---
Mark Yedinak - Certified LabVIEW Architect and LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot

#5 Eugen Graf

Eugen Graf

    Extremely Active

  • Members
  • PipPipPipPip
  • 435 posts
  • Location:Germany
  • Version:LabVIEW 8.6
  • Since:2003

Posted 19 August 2009 - 07:31 PM

Just look on the Web-Chat project by mine:
http://lavag.org/top...uss-eugen-graf/

#6 Phillip Brooks

Phillip Brooks

    The 500 club

  • Members
  • PipPipPipPipPip
  • 749 posts
  • Location:Boston, MA
  • Version:LabVIEW 8.6
  • Since:1999

Posted 19 August 2009 - 07:37 PM

Just look on the Web-Chat project by mine:
http://lavag.org/top...uss-eugen-graf/


I just downloaded it, tried it, and was going to suggest it! :thumbup1:

LabVOOP may be a bit much for someone new to LabVIEW though...

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T


#7 Eugen Graf

Eugen Graf

    Extremely Active

  • Members
  • PipPipPipPip
  • 435 posts
  • Location:Germany
  • Version:LabVIEW 8.6
  • Since:2003

Posted 20 August 2009 - 12:46 AM

I just downloaded it, tried it, and was going to suggest it! :thumbup1:

LabVOOP may be a bit much for someone new to LabVIEW though...


OFFTOP There is no much LVOOP, only a clever cluster, no more. So it's understandable by any.

TOTOP: So you may try to collect all connections into an array and send to all in a for-loop (if you use TCP) and send a broadcast to all if you use UDP (but without ack).