How to manage tcp buffer with array

I am having trouble parsing data from the tcpread buffer. I can parse the data from the buffer I was just wondering if the following is possible...Is there a way to have each tcp packet that is received be put into an array element instead of having the buffer append the in received data onto itself. It would be much easier for me if the buffer was divided in to packets that way I could just parse each packet instead of having to find each packet then parse each packet individually? I was just wondering if  there was an example or something, or do I need a vi myself to handle this. I noticed that the TCPREAD vi block has 4 options for the buffer...this is not one of them...but perhaps someone has done something like this before? Thanks for any help.

Unfortunately the project I have has a variable number of connections so it could be one or it could be up to 65535.
I've been thinking of a server-type example for my blog.
I've written a web server in LabVIEW before (1995 or so).  Basically you separate the listener from the service functions.
The listener listens for connections and puts CONN IDs into a pool (queue).  The pool contains all the connections that are active at the moment, along with some sort of status flag.
A service loop continuously extracts a connection cluster from the pool, handles it according to it's status, and either returns it to the pool, or terminates the connection and  removes it from the pool.
The idea is that the server is a sort of state machine which runs through all current connections and gives them some attention.
You could also do it by spawning a number of copies (one for each connection) of a single reentrant VI, but I don't know about the performance of that.  If you truly have a thousand connections at once, then you would have a thousand instances of this VI running in parallel.
That's a bit daunting to me, but then I've never tried it. Perhaps someone else could comment on that feasibility.  It would seem that the thread-management overhead might be a problem, but I don't know. 
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com
Blog for (mostly LabVIEW) programmers: Tips And Tricks

Similar Messages

  • How to do like this with array?

    How to do like this with array?
    I have 2 constants array put in main while loop ( array1{6,6}; array2{4,4} ). Those arrays will be come the input data for st in the small while loop inside.
    The input data look like : [6,6],[4,4],[6,6],[4,4]...... I have to put input data to result array[8]. The method is:
    input data result data
    [6,6] --------------------------------------------> [6,6,0,0,0,0,0,0]
    [4,4] --------------------------------------------> [6,6,4,4,0,0,0,0] ( this period, just add each element in new array)
    [6,6] --------------------------------------------> [6,6,4,4,6,6,0,0]
    [4,4] --------------------------------------------> [6,6,4,4,6,6,4,4]
    [6,6,4,4,6,6,4,4] ( 1st period )
    When the las index of result data array is filled in, I have to collapse the result data array to be this array:
    ----------> collapse: [6,4,6,4,0,0,0,0] ( take the average of 2 continuous element add to new result data array)
    Next input data
    [6,6] --------------------------------------------> [6,4,6,4,6,0,0,0]
    [4,4] --------------------------------------------> [6,4,6,4,6,4,0,0] ( this period, add the average of 2 continuous elements in new array )
    [6,6] --------------------------------------------> [6,4,6,4,6,4,6,0]
    [4,4] --------------------------------------------> [6,4,6,4,6,4,6,4]
    [6,4,6,4,6,4,6,4] ( 2 nd period)
    ----------> 2nd collapse [5,5,5,5,0,0,0,0] ( take the average of 2 continous element add to new result data array)
    Next input data
    [6,6] ....wait until input data has 4 elements
    [4,4] -------------------------------------------------------------------------------------> [5,5,5,5,5,0,0,0]
    [6,6] ....wait until input data has 4 elements
    [4,4] -------------------------------------------------------------------------------------> [5,5,5,5,5,5,0,0]
    [6,6] ....wait until input data has 4 elements
    [4,4] -------------------------------------------------------------------------------------> [5,5,5,5,5,5,5,0]
    [6,6] ....wait until input data has 4 elements
    [4,4] -------------------------------------------------------------------------------------> [5,5,5,5,5,5,5,5]
    [5,5,5,5,5,5,5,5] ( third period )
    ----------> 3rd collapse [5,5,5,5,0,0,0,0]
    This wayl to make the tren graph.I  made  an VI to do that , but it's not yet correct.
    Attachments:
    tryyyyyyy.vi ‏39 KB
    trend_mode.JPG ‏49 KB

    Frankly, I don't understand your problem description or your VI.
    In the description, the output array has a fixed size of 8 elements, is this correct? In this case you should initialize an array of 8 elements and do all operations "in place". I don't udnerstand the purpose of all the other code.
    There are a lof of things that don't make any sense at all.
    The second largest loop has no purpose, because it iterates only once per call
    Sometimes you are concatenating an empty array to an existing array. This makes no difference.
    Why is some of your data EXT representation???
    What's up with complicated constructs such as that small loop shown in the picture. I show a somewhat simpler alternative.
    Anyway, I have a hard time understanding your description. What should happen at the end? Do you have a link to a website that describes the algorithm? Does the algorithm have a name?
    Message Edited by altenbach on 01-10-2008 09:55 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Simplify.png ‏5 KB

  • How to manage answer tones with iPhone.

    I haven't seen this posted anywhere else, so if I am duplicating someone else's post I apologize ahead of time. But, if anyone was wondering how to manage answer tones with their new phone since it doesn't have access to Media Mall, the best way I have found is by going to cingularanswertones.com.

    Sync it as described in the User's Guide.

  • How to manage one library with two accounts

    how to manage one library with two accounts

    you can only be logged into one account at a time on the iTunes store. However, you can authorize your computer for both accounts, making your computer work with both. In the menu bar just click [Store > Authorize Computer]

  • How to manage J2EE Container with GUI?

    I have used Oracle9i J2EE Container for 6 months. I have managed via command-line (on Win2000). It's not convenient for admin the server. I searched for the documents about manage with GUI, admin tool or Enterprise Manager but I found a few document on Oracle website that didn't help me too much.
    Does anybody suggest me about any admin tool or how to use + configure Enterprise Manager or where to find rich documents?
    Thank you so much

    Narong,
    Enterprise Manager is available with Oracle9iAS Release 2 and OC4J is a managed component withiin Oracle9iAS. You have to download Oracle9iAS Release 2 from OTN(may be just J2EE Webcache edition) if you want to use the GUI tool.
    You can use the following link to download Oracle9iAS Release2 http://otn.oracle.com/software/htdocs/devlic.html?/software/products/ias/htdocs/winsoft.html
    regards
    Debu Panda
    Oracle

  • How to manage several databases with DWH

    hi,
    How to manage several databases within an Oracle datawarehouse.
    I.e. to memorize in a DWH the informations along various axes of analysis relating to each databases (I mean : operations, breakdowns, parmeters, caracteristic technical, statistics ...)
    Thanks
    Robert

    Mylenium, thanks for a helpful hint!
    I tried your suggestions and it seems that i have to save
    - mask shape and
    - Stroke effect settings incl. key frames
    as separate things, if i want them in the effects panel.
    When i set the Stroke effect to my preferred look (with custom colours, width, key frames for Start and Opacity) and save this as an effect, i cannot re-apply this to another mask with any of my custom settings still there. When i re-apply the saved custom Stroke effect, all settings like keyframes, custom colours and width are lost and it arrives with default settings and without any keyframes.
    Maybe i do something very wrong here?
    I wondered if i should save the mask with Stroke effect as an AE file and re-import it. But this mask can only be saved together with some footage and i don't see how to bring mask including Stroke effect into an existing composition and which of the File/Import ways to use.
    Thanks again!

  • How to Managing Firefox Settings with Group Policy?

    Hi
    Is there any way to manage Firefox Settings through Windows group policy?
    I want to replace Firefox with IE in the network but don't know how to customize the settings with GPO.

    There are some third party solutions that have worked for others in the past:
    You would need a user.js file and a lock file with a list a preferences please see the instructions on how to do this:
    *[kb.mozillazine.org/Locking_preferences]
    *[https://mike.kaply.com/2014/12/16/managing-firefox-with-group-policy-and-policypak/]

  • How to manage a connection with powershell using visual studio with C#

    Hi
     I want to manage a connection with powershell for a web app using visual studio with c#. and also run command with pipeline 
    Plz give a some suggestions..

    Hi Raj_Kumar_Saini,
    To make things clear, could you please clarify these thing?
    1. Do you mean you want to execute some PowerShell scripts from C# language? These blogposts may give you  some ideas:
    Executing PowerShell scripts from C#
    Powershell Automation and Remoting (a c# love story)
    Execute PowerShell from a ASP.NET Web Application
    2. Is your question related to Visual Studio Integration? Do you want to build a Visual Studio Extension?
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Create data buffer with arrays

    Hello.. I'm trying to create a data buffer but I can't...(I don't understand very well how to use the shift registers, feedback, auto-index, etc.) I receive real-data from 16 sources and I want the buffer to allocate 20 samples or so... (20 x 16 matrix or array). I'm trying to simulate the sources and using replace array subset, but I can't do what I want.. (that a single data fill the space in index 0, and when a value reaches index 19, the next number replace the one in index 0 and so on....)
    I want to create a buffer for when some disturbance ocurrs, I want to save the data from 1 or 2 seconds before the event. I think that I can use too a history data property node, but I'm not using a waveform chart anymore, because I want also the time stamp of the data in the xscale.. and with the chart I didn't manage to do it... (I tried with an offset property node.. but eventually the time in the xscale lagged the real time, I think that happens because the rate sample is not constant... but that's another problem.. =S)
    Thanks in advance for all your help...   Mitzi
    PS. I attach my attempt...
    Attachments:
    buffer_qst.vi ‏20 KB

    If you want a build a 20x16 array with only the 20 most recent values, what you can do is use the build array function to concatenate on the end of the data (you will need a shift register for this). 
    Next take the output of the build array and get the last 20 columns using the array subset function.
    (There's a real clever way to do this involving reversing the arrays, but I'm not going to confuse you with that).
    If you're still not getting it when I get home, I'll write up a VI and post it.  What version are you using?
    -Matt Bradley
    ************ kudos always appreciated, but only when deserved **************************

  • How to enable TCP Wrappers with SMF services?

    I am using a site.xml file to enable/disable services during a Jumpstart configuration. This works great.
    However, I can't yet figure out how to configure the various properties of those services, such as enabling TCP Wrappers for a service. I can set the properties of a service and verify that they are set, but a "svccfg extract" does not capture that information.
    Is this a short coming of svccfg extract? Or are the properties of a service stored and configured elsewhere?

    That will work, as will any path underneath
    /var/svc/manifest.Got it working...Exported the inetd configuration, set tcp_wrappers to false, dropped inetd.xml into my jumpstart tree, jumped a box, and tcp_wrappers came up enabled by default for my inetd services!
    What is the difference between the /var/svcs/profile and /var/svcs manifest directory? Is profile for enabling/disabling services and manifest for service configuration?
    Does /var/svcs/profile/site.xml and /var/svcs/manifest/whatever.xml get read on every system boot? If not, what is the appropriate procedure to "reinitialize" smf if you want to change the existing behaviour by having it reread those files?
    Hmm. The defaults get written on the inetd serviceI believe, so exporting that would give you the
    fragment
    you want.It did, and I was able to accomplish what I needed to do.
    Sorry that it's such a slog in the meanwhile.Will there be something before FCS in a couple weeks?
    I can definetly see the managability and robustness of SMF. It's just going to take time to learn it, and documentation is needed for that.
    Thanks for all your help!

  • How to test a class with array which is being declared?

    Dear All
    I am doing a question which involved the day of the week.
    I had written a class which is name WeekDay and here is the code :
    public class WeekDay
    private int index;
    private static String[]dayStrings = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
    public WeekDay(int idx)
    index = idx;
    public int getIndex()
    return index;
    public static String nextDay(int index)
    index+=1;
    return dayStrings[index];
    The above compile well with no issue.
    Here is the problem which i need to seek your help, I had created a program to test the above program.
    But I am not sure how to test it.
    Here is what I had written :
    public class TestWD
    public static void main(String[]args)
    System.out.println("Please key in a digit to get the day of the week\n");
    System.out.println("Sun, Mon, Tue.....Sat is represented by 0,1,2,3...6");
    int idx = Integer.parseInt(args[0]);
    WeekDay wd = new WeekDay(dayStrings[]); // I can't seem to declare this line.
    My question how can I test the above program ?? I can't seem to be able to declare a "wd" from WeekDay. The dayStrings wich i had declared in the WeekDay class is a String array. But how can I declare a suitable line in my test program in order for me to test my program?
    What I wanted to do is to get the above line running and than I will proceed on to code it to display the day after a day...for example, if today is Wednesday and when I run the wd.nextDay(index). It will return me Thursday!
    But I am not sure how to declare the above...please enlighten me.
    Thank you.

    Hi
    Thank you for helping but when I compile my program. It seem fine but when I execute it, it prompt me with an error message :
    code}public class TestWD
    public static void main(String[]args)
    System.out.println("Please key in a digit to get the day of the week\n");
    System.out.println("Sun, Mon, Tue.....Sat is represented by 0,1,2,3...6");
    * int idx = Integer.parseInt(args[0]);*
    WeekDay wd = new WeekDay(idx);
    System.out.println(wd.nextDay(idx));
    }{java.lang.ArrayIndexOutOfBoundsException: 0
         at TestWD.main(TestWD.java:8)
    Edited by: SummerCool on Nov 1, 2007 2:53 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to manage two viewstacks with one linkbar?

    hello all,
    I currently am creating my website utilizing flex and have come across a roadblock.  I need a single linkbar to manage two viewstacks but cannot figure out how to do this so far.  i have tried using both id's in the dataProvider but the only one it manages is the last input.  please advise how to do this or another way in which i can accomplish what i am trying to do.
    for your information:  one viewstack will be for the pages of the site and the other will be for banners on each page.  I cannot put the banners in the viewstack because they will be larger than the pages
    here is some of the code:
    <mx:LinkBar x="10" y="116" dataProvider="{body, ads}" fontSize="18" height="29">
    </mx:LinkBar>
    when i run the application i do not receive any errors however the only viewstack that changes is the ads or vice versa if i have body last.

    Sure, user a Timer:
    http://livedocs.adobe.com/flex/3/html/help.html?content=08_Dates_and_times_4.html
    http://blog.flexexamples.com/2007/08/14/creating-a-simple-timer-in-flex-with-the-flashutil stimer-class/
    http://livedocs.adobe.com/flex/3/html/help.html?content=16_Event_handling_7.html
    http://www.cs.vu.nl/~eliens/im/assets/flex3/langref/flash/utils/Timer.html
    If this post answered your question or helped, please mark it as such.

  • How to manage two iclouds with the same Apple ID

    My wife and I share the same Apple ID and the same ICloud, but now we have shared all our contacts. Is there a possibility to create to IClouds to manage different contacts and agendas but with the possibility to continue using the same Apple ID to purchase in Itunes?

    Just create a new iCloud account for one of you and sign in with it in System Preferences (or Settings)>iCloud. You can retain the common ID in iTunes - there's no problem about iTunes and iCloud having different logins.

  • How to manage two iPhones with one Apple ID

    My company is moving to iPhones and away from BlackBerry so I may soon end up with a second iPhone.  I believe that I can set up the app store account using my current Apple ID so I can download apps that I have already purchased to the new phone.  But do I need to set up separate iCloud accounts?  And if so how do you do that?

    use your existing apple ID.

  • How to populate a table with array loop

    I'm looping an array object and as I loop, I'm calling a function and this function returns 6 items
    <CFLOOP  from="1" to="#ArrayLen(zz)#" index="k">
      <cfdump var="#zz[k].getLine()#"> <p>
    </CFLOOP > 
    The above cfdump will return something like:
    [empty string]
    street name1
    [empty string]
    [empty string]
    city1
    state1
    zip1
    [empty string]
    street name2
    Apartment AA
    [empty string]
    city2
    state2
    zip2
    street name 3
    Margenthaller Hall
    Suite 202
    city2
    state2
    zip2
    etc
    I need to insert these results into my address table while looping.
    When I did the following (see below), each record got repeated 12 times (not sure why)
    <CFLOOP  from="1" to="#ArrayLen(zz)#" index="k">  <cfdump var="#zz[k].getLine()#">
      <cfquery name="test" datasourece="MyDNS">
       INSERT INTO MyAddr (street1,street2,street3,city,state,zip)
       VALUES ('#zz[1].getLine()#', '#zz[2].getLine()#', '#zz[3].getLine()#', '#zz[4].getLine()#','#zz[5].getLine()#', '#zz[6].getLine()#')
    </cfquery>
    </CFLOOP >
    Is there a way? to do insert as I already got the address correctly while looping but not sure how can I use the return result in insert statement.
    Can anyone help?

    For what you seem to be doing here, the loop is unnecessary and causing the multiple inserts since the <cfquery...> is inside the insert, it will be executed for each and every iteration of the loop.
    You COULD put the loop inside the <cfquery...> to build the repeating part of your query I.E. the VALUES clause it seems in your case.  But, unless you would have different sized arrays I would just do what you are doing and explicitly calling each array element.  I.E. the zz[1]...zz[2]...zz[3]...etc. that you have.

Maybe you are looking for