03-18-2017 11:26 AM
Hi there!
I have compressed two hours sensor data (the data is stored in .csv file) into zip file. After reading several examples on TCP/IP connections, I know that I need to send the size first and followed by the file. The connection is established between the two PCs but the trouble is about sending the size of the zip file and the file itself.
I tried to send the size using the "Get File Size" function and type cast it into first tcp write function but it returns me error code 1 which I believe it is invalid parameter.
As for the file I used the strip path to obtain the zip file and type cast it into second tcp write function.
What is the input used for the size and file?
Solved! Go to Solution.
03-18-2017 11:54 AM
Attach your VI so we can see what you are doing!
I don't know why you would use Strip Path to send a file.
Sending a zip file through TCP/IP shouldn't be any different than sending any other file, or any other binary data.
03-18-2017 12:18 PM - edited 03-18-2017 12:30 PM
What is listening on the other end?
I assume that the receiver is also a LabVIEW program that you can modify.
On the sender side
On the receiving end:
Of course if the receiving end is a standard server (e.g. ftp), you could use datasocket functions instead.
03-21-2017 10:50 PM
Hi there! Unable to reply asap as I was busy on other stuffs. Thanks for the reply.
By the way, I solved the error code 1 problem. It is because I wired the wrong id (listener id), I just change it to connection id and it worked. Now, I am having the problem of error 66, after sending the file size but cannot create the zip file.
Below attached image on how the zip file is sent and where the error 66 occurred.
03-21-2017 11:54 PM
You never read or send the content of the file. read my instructions again.
(Please attach the actual VI, we cannot debug pictures and we cannot see what's in the subVI)
03-22-2017 01:20 AM
Is snippet okay? I made some of modification of the code using read and write from binary file.
The zip file created but it is corrupted.
The content of abc.zip is just random .txt files as I can't really upload the real file (privacy problem).
03-22-2017 01:29 AM
Below zip file contains both sender and receiver vis. They are the same as you see in those snippets.
03-22-2017 01:42 AM - edited 03-22-2017 01:44 AM
I don't understand the case where you create a zip file. That makes no sense. The zip file is created when you write the received binary string to file (with the existing zip extension)
(That's it for now. There are many other things that are quite confusing....)
03-22-2017 02:55 AM
Hey guys, I have solved the problem. When I feed in the file size into "read from binary file" function, it worked like charm. Thanks everyone!