Paulo Almeida Posted October 4, 2004 Report Share Posted October 4, 2004 Hi, One more topic for nobody reply. I have a array which i want to send by tcpip. that array is building in a independetly while loop and i have other while loop to send information by tcpip. i use a local property to transport information of one loop to other. but i only want to send by tcpip, the information of array when it have one number of elements. help me please Quote Link to comment
James McAnanama Posted October 4, 2004 Author Report Share Posted October 4, 2004 One more topic for nobody reply. 2088[/snapback] Hey now... We're all listening Paulo. I have a array which i want to send by tcpip. that array is building in a independetly while loop and i have other while loop to send information by tcpip. i use a local property to transport information of one loop to other. Have you taken a look at LV examples? (in LV, Help>Find Examples). Search on TCPIP. They have examples on sending an array of data over TCP/IP. Also, Mike's asynch process presentation has a clear example of serving data across multiple TCP/IP connections. http://lavausergroup.org/niweek2004/meetin...niweek_2004.zip but i only want to send by tcpip, the information of array when it have one number of elements. I am not clear on what you want.... You want it to make a connection when you have >=1 elements? You want to make a connection if and only if you have 1 element? Please explain for me. Cheers, James Quote Link to comment
Paulo Almeida Posted October 5, 2004 Report Share Posted October 5, 2004 Dear James I am devoloping a project with a server and multiple clients, with base on exemple of LV, but i am acquiring data in DAQ board in other while loop. but i want to send all information in that while loop for all clients,that data are in a array and i want to send it when it have a number of elements and repeat this operation several times. I hope you understand that, my english is not very good best regards Quote Link to comment
jpdrolet Posted October 5, 2004 Report Share Posted October 5, 2004 Hi Paulo, I have posted the code for the BabVIEW server here. You could use the same technique: every time a new array element is available, notify its value to all opened TCP connections. Take a look at the code and feel free to ask more questions (Sorry, PM seems to be down) Jean-Pierre Quote Link to comment
James McAnanama Posted October 5, 2004 Author Report Share Posted October 5, 2004 Hey Paulo, Another suggestion might be to use DataSockets. Your server is a datasocket writer, and your clients are datasocket readers. DataSockets are abstract enough that you don't have to worry about handling multiple connections - you just subscribe to the url of the data source and read when ready (or read, waiting for data). See LV examples. If you like the TCP/IP approach, then I believe Jean-Pierre's suggestions are best. Cheers, James Quote Link to comment
Paulo Almeida Posted October 5, 2004 Report Share Posted October 5, 2004 Hey Paulo,Another suggestion might be to use DataSockets. Your server is a datasocket writer, and your clients are datasocket readers. DataSockets are abstract enough that you don't have to worry about handling multiple connections - you just subscribe to the url of the data source and read when ready (or read, waiting for data). See LV examples. If you like the TCP/IP approach, then I believe Jean-Pierre's suggestions are best. Cheers, James 2104[/snapback] Hello Yes the DataSockets it's a good option but i need receive all samples of server in all clients and datasocket it is a connection loose, or something that. And if i loose any data of server the clients will make calculation bad. Thanks and the best regards Paulo Almeida Quote Link to comment
didierj Posted October 6, 2004 Report Share Posted October 6, 2004 If you are afraid of loosing data over the net, then you'll have to add an acknowledge: 1. Send the data to each client 2. each client calculates a checksum from the received data, e.g. CRC16 3. the clients sends the checksum back 4. if the server gets a wrong or no checksum back from one client, he sends the data again to this client. This would also mean that each connection is handled (in the server) separately, so your server exactly knows which client doesn't work correctly. A broadcast won't work. Didier Quote Link to comment
James McAnanama Posted October 6, 2004 Author Report Share Posted October 6, 2004 Paulo, I don't know the details of your application, but based on the fact that you have one server and many clients, and the fact that you want to keep all data, I am thinking that you are using your DAQ vi as a data logger and the client vi's as remote analysis tools(?). If this is the case, perhaps you should use an SQL database. The DAQ vi would insert the data to the database, and the client apps would pull from the database. This way the DAQ vi doesn't have to keep track of what data is still pending transmission, the data is not volatile (lost in power outage etc) , large amounts of data are easily handled, and the SQL data can be accessed remotely by everything from LabView to Excel to web pages. :2cents: James Quote Link to comment
Paulo Almeida Posted October 6, 2004 Report Share Posted October 6, 2004 Hello, I don't know the details of your application, but based on the fact that you have one server and many clients, and the fact that you want to keep all data, My application is based in a server and multiple clients but those clients have different types. There are clients who only wants to view the results of server and there are clients who wants control the application of that server, but server makes what it wants, view or controller. I am thinking that you are using your DAQ vi as a data logger and the client vi's as remote analysis tools(?). If this is the case, perhaps you should use an SQL database. The DAQ vi would insert the data to the database, and the client apps would pull from the database. your ideia of DAQ it's good but i must use other tool, MATLAB(restritions of my supervisor), for the clients analysis the receive data. I have two options: 1 Quote Link to comment
Paulo Almeida Posted October 6, 2004 Report Share Posted October 6, 2004 Hello http://lavausergroup.org/niweek2004/meetin...niweek_2004.zip 2090[/snapback] I've worked in that application, mainly in the Example4 - Reentrant_example_tcpip_connections and like that. But server don't send anything for his clients. the time which is sending is on the DateServerHandler and the user can't controller. How can i put a string control in a server and type anything and send for all clients I'd seem all methods of invoke node and i only can view things for set controls, there are any thing gor get indicatores of vi handler.? i think i'll go for :beer: and forget LV The best regards Quote Link to comment
James McAnanama Posted October 7, 2004 Author Report Share Posted October 7, 2004 But server don't send anything for his clients. the time which is sending is on the DateServerHandler and the user can't controller. How can i put a string control in a server and type anything and send for all clients 2138[/snapback] I think what you want to do is use a named queue. In your data acquisition process, you will populate this queue with your data. The application that runs your data acquisition process must also launch the TCP server. For each instance of your reentrant server you will access this named queue and will send the data down the tcp port to your client. You will need to add some two-way communication between your client and the server to tell the server when to flush the queue. You could even add the capability for each client to broadcast messages to each other by writing and reading a separate queue on the server. Keep in mind that the clients cannot see the queue directly (only the server PC has access to the queue -it adds data, removes data, and can then transmit this data back to the clients). I have attached an example - A VERY QUICKLY WRITTEN EXAMPLE - to get the idea across. Launch the Number Generation vi in the llb. Next launch the client vi (these vi's are all modifications from Michael's example 4 - I hope that is okay Michael). Basically the number generation vi launches the server and then enters a while loop where it continually adds random numbers to a named queue. When the client vi makes a connection, the server reads the entire contents of the queue, deliminates each reading with a pipe (|) and sends this deliminated string to your client. Notice that the data is added to the queue faster than it is read (i.e. no loss of data). Keep in mind that nothing removes data from the queue at this point - you will have to add that feature. If you were to make another connection, you will get all of the data from the start of the process. You can break the string into the numbers by using the pipe (|) as your deliminator. Okay, I hope this helps - I haven't spent a lot of time on it, so I am sorry if I have missed something - let me know. Cheers James Download File:post-365-1097178076.llb Remember :beer: doesn't keep you warm at night, but LV sure does.... was that out loud? Quote Link to comment
Paulo Almeida Posted October 8, 2004 Report Share Posted October 8, 2004 Hello Yes, that me help, help me a lot, thanks :worship: Your Number generator will be my server. but i having a douth . i 'm trying to do a client supervisor in my server for manager who command the process in server and other thinks able to do in that. my douth is where i put my supervisor, if in my server or if in dateserverhandler. In relation of the queue, it's a good ideia. but i won't to send all information for all clients. I want to send the information for a client since he arrived not since the server runned. I think if i create a queue for all clients connected, when they arrive i clean that queue and send only present information. but i'd studied more in that. :headbang: Thanks for all The best regards paulo Almeida Quote Link to comment
James McAnanama Posted October 8, 2004 Author Report Share Posted October 8, 2004 but i'd studied more in that. :headbang: 2177[/snapback] I recommend picking up a book: Conway & Watts, " A Software Engineering Approach to LabVIEW" ISBN 0-13-009365-3. The book describes more advanced usage of queues. For example, sending a cluster as the queue type. In this cluster you have a component (e.g. a string) describing the intent of the message, or who should use the message, a component that is the command to execute (e.g. clear, run, stop, etc), and a component that contains any numerical setting required by the command. I think this approach would help in your client<->server communications. The client would send a formatted message over TCP/IP to the server, the server would then submit this to a queue for the rest of its application. Everything from adjusting PID gains to controlling data in memory could thus be administered remotely. Good luck, James Quote Link to comment
Paulo Almeida Posted October 10, 2004 Report Share Posted October 10, 2004 Okay, I hope this helps - I haven't spent a lot of time on it, so I am sorry if I have missed something - let me know. I found one think and i don't to know how to resolve, in your date server handler you receive all queue at period of 500ms, but in this case, when passed some time you send a string for tcp which incresed too, and the date transfer go for hell i put the dequeue element and the queue works well for only one client, when i put two clients the receive string in client pass for half, but it's logic how can i send one element for clients but not erase the queue and not nedd pause the while loop. :headbang: Quote Link to comment
James McAnanama Posted October 12, 2004 Author Report Share Posted October 12, 2004 You will have to add some logic to the queue handling - if you pull data from the queue, then it is gone! You will have to control which reads are destructive, and which are not. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.