I have a set of codes written in C++ for a mini VNC. What the code do is to connect to a server and server send (every 1 second a screen shut of the UUT, The code also exchanges keyboard events (not interested at this point) The server runs on a Linux and client on a window.
The client connects to the IP address of the server with a UDP connection
I need to convert this C++ to labview but I have not been able to even start. That is, I can not do the simple connection. All examples ( I have gone through all UDP examples in Labview) given in Labview has no IP connection from client to server. It appears that I need to establish a connection from client to server and have the connection reference to continue.
Can someone please look at the way the c++ version connects to the server and open a small window and give me a sample segment code that does the same in Labview.
I would also pay reasonable fee if someone can help.
I can't help you by reading the C code! But..
Are you trying to write the software from the client side or server side? It sounds like you are trying to write the code for the client side.
If this is the case, you need to know what port the server is trying to write to, and make sure that the server is writing to the IP address of your client or to the whole network.
If you know the port, you can just set up the UDP to listen to that port and take action when data appears (as per the UDP receiver example).
I'm (very) far from being an expert but as I understand UDP, you don't set up a connection in the same way that you would with TCP. Its pretty much a case that whatever is sending the message just puts it 'out there' and hopes it arrives.
Hope that helps,
Thank you for the reply Ian,
I am trying to rewrite the client version.
I am using the same port for the client as the server uses but I have to connect the client to server using the server IP since there is no way one can possibly assign all possible IP address that the client(s) might get from DHCP, to the server.
This is why I don't understand the UDP examples in NI site and Labview software. In all examples, server has the client IP !!!
In the examples the server has the option of writing to FFFFFFFF in order to write to the whole network. In this way it doesn't need to know all of the possible IP addresses. I would assume that your server could be set up to do the same?
Well most of the code in your C file does nothing with the network.
Basically the socket() and connect() functions together are mostly what you would do with UDP Open.
Then wherever you have sendto() you use UDP Write. set_msg_header() is replaced by code to pack the data into a byte array stream (string). The address and port is directly passed to UDP Write
recvfrom() corresponds to UDP Read.
closesocket() is UDP Close.