Jump to content

Transfer Files via TCP/Ip in LV


Recommended Posts

Hello

I am developing an system with one server and multiply clients, in this moment i can transfer the most type of data, arrays and strings. But i having a problem on transfer files between the clients for the server. I read the file on the client but i can't send to the server. I saw the examples in Labview examples but they used Datasocket communication and id like use only the TCPIP communication.

Someone can help me?

Sorry for my bad english :headbang:

Link to comment

Paulo,

Just open and read the file as a text-file. Send the read "string" over TCP the way you are used. On the client read the "string" from TCP, create a new file and write the "string" to this file.

Maybe you'll have first to send the filename (also as a string) over your TCP connection, so your server knows the name of the file.

LV doesn't care of the real type of the file. LV reads byte by byte and puts them into a string.

Didier

Link to comment

Hi,

I try that but i have problems on side of Server, because in sever i have one cycle which receive same information for all clients. and i want send file from clients only one time and with permission of server. i'll try send one boolean variable for all clients for clients send the file if their want.but i don't have more ideas and don't know to work with datascoket.this tecnologi have very qualities but i don't know how to work with it.

Tanks for reply me :worship:

Link to comment

Hi,

ok, now the failure message 66 is off :D

Now I have an connection between my two PC's, I can sent one string from one PC (1) to an other PC (2) :thumbup:

My next challenge is to send this string back to PC 1 and there I have to compare these two strings (I must find out if the sting I sent is the same string I received) and make it visible with an LED.

But I don't know how to sent my string back. Must I open the TCP connection a second time after reading TCP on PC1?

Is it possible to send a string from a PC to an other PC without LV installed and sent this string back to the PC where LV is installed? Or must LV be installed on both PC's?

Link to comment

I'm doing TONS with Tcp/Ip right now, but I'm mostly passing binary strings in a protocol with header and checksum.

You don't have to have LabVIEW on 2 machines to communicate via tcp/ip, but one machine needs to be set up as a server, and the other a client.

Just so long as you have a program on each PC that can act as one or the other, and be able to connect to an IP address and port as well as have the ability to accept the strings it receives you should be able to.

I have a LabVIEW program acting as a data acquisition host on a PXI chassis. Using TCP/IP, I can connect to that PXI chassis from any computer that can access it's IP and specified port. I've run LabVIEW as a host, Tcl as a client and vice versa as well as various combinations without problems.

So, to answer your question, no, you don't have to have LabVIEW on both machines, BUT you have to have a program on your PC without labview that's able to connect to your PC with labview via ip and port and send/receive strings.

I believe you could use hyper terminal for that, I think it's standard on most PCs, but I've never used it so I couldn't tell you what to do.

EDIT:

I just opened hyperterminal on my computer and tested it with my program here at work. You can create a new connection via TCP/IP, specify an IP and Port and it will run as a receiver, displaying the ascii representation of what it recieves, but I don't know how to send things back to it. It provides the ability to send/receive files and text files, but I don't know how it works. I couldn't do it with mine because my LabVIEW program communicates with our own proprietary in-house protocol, it will reject normal text sent to it.

Link to comment
Hi,

ok, now the failure message 66 is off  :D  

Now I have an connection between my two PC's, I can sent one string from one PC (1) to an other PC (2) :thumbup: 

My next challenge is to send this string back to PC 1 and there I have to compare these two strings (I must find out if the sting I sent is the same string I received) and make it visible with an LED.

But I don't know how to sent my string back. Must I open the TCP connection a second time after reading TCP on PC1? 

Is it possible to send a string from a PC to an other PC without LV installed and sent this string back to the PC where LV is installed? Or must LV be installed on both PC's?

1614[/snapback]

I don't understand your doubth but i think for your problem you have a tool in labview "equal" if you can acess both strings and this tool you can compare.

But for you change Strings you need labview in the two pc or you can make a program in C for communicate with tcp port, good luck :thumbup:

You can also make an executable tougth builder of LV but i don't try this yet

Link to comment
I don't understand your doubth but i think for your problem you have a tool in labview "equal"  if you can acess both strings and this tool you can compare.

But for you change Strings you need labview in the two pc or you can make a program in C for communicate with tcp port, good luck :thumbup: 

You can also make an executable tougth builder of LV but i don't try this yet

1616[/snapback]

How to compare is clear, but how to sent the stings back ;) ....

I will try to find out something about Bryan's solution

Link to comment
How to compare is clear, but how to sent the stings back ;) ....

I will try to find out something about Bryan's solution

1623[/snapback]

To send strings back: on your server just do a write operation after the read of the client message ...

Client : WriteMsg, ReadMsg(with timeout 60 sec)

Server: ReadMsg(with timeout 60 sec), writemsg

cheers, Alex

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.