LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Broadcast TCP ?

Hello,

I'm "playing" with the tcp functions in CVI6. My goal is:
-) I have several PCs arround the site running an acquisition program;
-) I'm modifying those programs to act as server;
-) I'm writing a central client wich will gather datas from all the
servers;

Well, at this point of development all is ok: I tell the client all the
IP adresses of the differents servers and then, it connect, ...

I would like to change the behaviour of this as I do not always know the
current configuration of the "acquisition network": is there a way to
identify all the servers listening a specific port on the network.
I heard something about broadcast messages but don't know how does it
work.
Thanks for any help,
--
Fred.
0 Kudos
Message 1 of 5
(3,563 Views)
Broacast messages are messages that a server can send out to all connected clients, they can't be used from clients or to check for servers. The only way to check for servers on the network with CVI functions is to try and connect to them with ConnectToTCPServer. You will get a timeout error if the server is not there.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 5
(3,563 Views)
Well, I thought at this solution, trying to connect to all ip adress in
the subnet, but this is quite a hard way to solve the problem.
I'm really new to network programming, but found some informations on
internet. Tell me if this solution is realistic:
using the UDP fp, is it possible to open a UDP socket in read mode on
each program, waiting for a simple message, and then the main supervisor
send an UDP message on the broadcast address containing just its own IP
address. Would the differents programs on the subnet get the message in
this case ? If yes, then they will know the address they should connect
to the supervisor in TCP mode, that's right?

Thanks Chris for your help,
--
Fred.

Chris Matthews a ecrit :

> Broacast messages are messages that
a server can send out to all
> connected clients, they can't be used from clients or to check for
> servers. The only way to check for servers on the network with CVI
> functions is to try and connect to them with ConnectToTCPServer. You
> will get a timeout error if the server is not there.
>
> Best Regards,
>
> Chris Matthews
0 Kudos
Message 3 of 5
(3,563 Views)
Just for info for those who later may need such a functionality.
I tried the UDP method, opening an UDP socket in waiting read mode and
flushing an UDP message on the broadcast address. All the nodes in the
network receive the message correctly and then they now who is the emettor
(the ip is in the message) and can connect in tcp mode.
That's all.


Frederic MAILLET a ecrit :

> Well, I thought at this solution, trying to connect to all ip adress in
> the subnet, but this is quite a hard way to solve the problem.
> I'm really new to network programming, but found some informations on
> internet. Tell me if this solution is realistic:
> using the UDP fp, is it possible to open a UDP socket in read mode on
> each program, waiting for a simple m
essage, and then the main supervisor
> send an UDP message on the broadcast address containing just its own IP
> address. Would the differents programs on the subnet get the message in
> this case ? If yes, then they will know the address they should connect
> to the supervisor in TCP mode, that's right?
>
> Thanks Chris for your help,
> --
> Fred.
>
> Chris Matthews a ecrit :
>
> > Broacast messages are messages that a server can send out to all
> > connected clients, they can't be used from clients or to check for
> > servers. The only way to check for servers on the network with CVI
> > functions is to try and connect to them with ConnectToTCPServer. You
> > will get a timeout error if the server is not there.
> >
> > Best Regards,
> >
> > Chris Matthews

--
F. Maillet - Sodatec Toulouse
Responsable Qualite Projets
0 Kudos
Message 4 of 5
(3,563 Views)
OK Guys, I have in some way the same problem treated in this discussion forum, All mi client applications need to know when the server that collects data starts or shutdowns. For the fisrt i use a DataSocket, when the server shutdows changes a flag on it and all the clients connected to that socket knows the server goes out. But when i start my server i need to send a message (on a defined port) to all machines on my LAN, for make my client applicactions to be capable to catch that message on that port for know the server has already started and then, connect to it. Using UDP sounds to be the solution, but How I can Improve a UDP protocol in LabWindows/CVI, or a UDP message or UDP Socket as mentioned above? Please help is crutial for my sistem
to perform this operation!!!!!
0 Kudos
Message 5 of 5
(3,563 Views)