LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Mr._Jim

Refactor or Rewrite the TCP Listener Internecine Avoider

Status: New

Hello,

 

I'd like to humbly and respectfully suggest that "Internecine Avoider.vi" be rewritten or at the very least, refactored extensively.  (again)

 

This VI is found in "TCP Listen.vi", which is on the TCP palette.  It maintains a registry of existing listener connections and attempts to reuse them.

TCP.png

 

What's the big deal, you ask?  Well, when I'm having problems with listeners and need to figure out what's going on, sometimes I need to look into this VI.  Like a lot of NI code that I generally trust, I would ordinarily skip over this and disregard it as a possible source of problems.  The trouble is, every time I look at it I can't easily decipher the nuances of what it does, given its messiness.  Thus, though it may be perfectly functional, I don't trust it.

 

I realize the code could be a whole lot worse.  I also realize that someone has been in there since LabVIEW 2011 was released and has made some improvements.  Smiley Wink  Kudos to that individual for all the new free label comments.

 

Nonetheless, here are some factors that obfuscate this VI:

 

  1. There is no documentation under "VI Properties".  What does it do, at a glance?  (I know the answer because I've stared at it over a few versions of LabVIEW)
  2. "TCP Listen Internal List.vi" also has no documentation under "VI Properties"
  3. Without nitpicking, there are some sloppy practices employed in here that don't make a lot of functional sense.
  4. Deprecated "Retrieve Element" case in the internal list VI.  "Item Requested" is no longer a requested item, but the result of a search on elements.
  5. "net address" is confusing and ambiguous  Couldn't this be named, "Address of Listening NIC?" (Yes, I know it's documented under LabVIEW help for the TCP listener VI)
  6. "Conflict" is ambiguous.  This should be renamed to something more intuitive like, "Conflict: Multiple NICs Using Port" or something similar.
  7. Un-typedef'ed clusters in the internal list VI, with deceptive ordering of elements, combined with unnamed unbundler functions.

... etc.

 

I got to thinking... I know it works, or at least I think it does, but couldn't this be done more simply and elegantly?

 

I know, I know, "If it ain't broke, don't fix it."  ... but I think it could still use some work to make it more intelligible.

 

Respectfully,

 

Mr. Jim

 

InternecineAvoider.png