LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

lan communication one to many

Hello.

 

I need to do simple application that will allow computer user to set status busy/offline online and so on on one computer.

Other users will be updated and see that this person is busy. and they can do the same.

 

Something like messanging app that will allow users to see each other status.

 

Do You have any ideas how to start implementing that? I am very gratefoul for any kind of suggestions 

0 Kudos
Message 1 of 11
(3,920 Views)

You would probably want to look at creating a server/client architecture using TCP/IP or Web Services. That's probably the most appropriate architecture for this sort of thing - have a 'server' application which runs on one PC and a 'client' application which reports the current user status to the server and allows users to view/get the status of other users.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 11
(3,908 Views)

I think I ll go with TCP/IP because I will need to add SQL database to that later. And I don't fully understand how these web servers work. 

 

So when client logs in it will have some connection ID so that server knows who is who and what is his request?  What about protection of that, When I sent something over tcp via flattern to string it is secure?

 

When I add sql database client will send something to server and server will communicate with database?

0 Kudos
Message 3 of 11
(3,899 Views)

Exactly, you will need to implement some sort of communications protocol between your client application and the server application. You are right that the server should do the database communication.

 

I would suggest using a string-based protocol - something like JSON is ideal for this - the problem with flatten to string/XML is that if you change the cluster type definition your unflatten from string won't work if the clusters don't match so you would have to be very careful about changing the clusters. 

 

As for whether it's secure secure...it's only secure if you make it secure. If you're sending unencrypted string data then it's possible to intercept the data and see what's contained inside. You should probably look at some sort of encryption algorithm for encrypting/decrypting your TCP data. I wouldn't be surprised if there were some toolkits available that do this on the LabVIEW tools network.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 11
(3,889 Views)

Big thanks for help 🙂

 

One last question

Lets say that all clients and server monitors some port to see if there is new data. How server can find out where to sent response data? Client needs to provide him with IP adress or something?

0 Kudos
Message 5 of 11
(3,881 Views)

I have seen example where client sents its TCP/IP connection ID. When server writes data to that connection ID client will read it. Does that work like queue because I have my doubts...

0 Kudos
Message 6 of 11
(3,877 Views)

Look at the client/server examples in the LabVIEW help. They show the ways to implement a client/server architecture - including with multiple clients.

 

Essentially you listen to a TCP connection from the client and once established, you can send/receive TCP data down that connection. Your client will send a request to the server along that TCP connection and you can process the command and send a response back. Your server will need to keep track of the client and the associated TCP connection so you can identify each one appropriately if you want to have the server send messages (rather than just a request/response).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 7 of 11
(3,866 Views)

Thanks for help. You solved most of my problems. Smiley Happy

 

I don't see problem with flattern/unflattern from string because if cluster is typedef it will always match. Or I don't see somethingg?

I think this should be good as encryption mechanism:

http://vigods.com/toolkits/security/aes.html

 

I am no expert in protection stuff

I think when someone wants to talk with server in first response  will get some random key and all messages that ate sent after that in both ways will be AES encrypted by that key. If server can't decipher message it will mean that client is invalid and connection will be closed.

 

Edit.

And one last question. Lest say that server has 20 open connections. I can check if there is new request to server in series one connection after one or make reentrant vi that starts and monitors active connection individualy and shuts down when connection closes. Is there a limit of how many instances of one function can I open? Or memory and CPU is my only limitarion?

0 Kudos
Message 8 of 11
(3,853 Views)

As long as you make sure that you update all of the clients / server after changing the type-def it's fine. If you have some clients running an older version of the application where the type-defs don't match then you might get errors in your unflatten from string.

 

In my applications, I launch a reentrant VI when a connection is established and use that for handling the connection (with communications between my server and the connection handlers). I don't think there is a limit (or if it is, it's a theoretical one) - you're more likely to run into performance issues before you run out of clones.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 9 of 11
(3,814 Views)

Thanks. I was thinking about that ant that seems to be bit more complicated than I thought when comes to bidirectional communication... Or I am confusing something.

 

Lets say Server monitors port 2600 for new connections.

Client connects says that he wants data to be sent on adress xx and some port, handler is created and he knows where to sent data.

But when client sends data it will go to the server and not handler. Then I ll have to pass data from server to handler or I am getting something wrong?

Or handler needs to say that now this client will have special port?

 

In this system clients will sent some events so It will be asynchronous messages.

Server will sent synchronous messages to all clients but also some asynchronous messages to specific clients.

 

0 Kudos
Message 10 of 11
(3,778 Views)