Jump to content


Photo
- - - - -

file transfer using UDP protocol

file transfer udp

  • Please log in to reply
45 replies to this topic

#21 moralyan

moralyan

    Active

  • Members
  • Pip
  • 18 posts
  • Version:LabVIEW 8.5
  • Since:2011

Posted 22 April 2012 - 08:45 PM

It means a piece. A bit. A portion.......of the file.

For GOD sake, this is my VI, please help me, i know TCP is better, but i just wanna see it working with UDP, so what shall i change to not see this error message anymore :(

Attached Thumbnails

  • labview code.png


#22 ShaunR

ShaunR

    LabVIEW Archetype

  • Members
  • PipPipPipPipPipPip
  • 2,604 posts
  • Version:LabVIEW 2009
  • Since:1994

Posted 22 April 2012 - 11:30 PM

You are loading the ENTIRE FILE then trying to transmit (all 600MB presumably) in one go. To remove the error you need to send a maximum of 1500 bytes of the file A BIT AT A TIME by reading the first 1500 bytes, write that to the UDP port then reading the next 1500 bytes and write that .... and so on - a method of which I demonstrated to you in the image posted for bluetooth earlier (the code for which you can download from the Code Repository).

Short of writing it for you (and it is not my home-work), there is not a lot else I can tell you. Perhaps someone else can explain it better than I :rolleyes:

Edited by ShaunR, 22 April 2012 - 11:32 PM.

  • rolfk likes this

A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort. (Herm Albright 1876-1944).

Founder and general mischief maker on www.lvs-tools.co.uk.
SQlite aficionado and websocket zealot.
If it 'aint in LabVIEW, then you 'aint got a clue!


#23 Phillip Brooks

Phillip Brooks

    The 500 club

  • Members
  • PipPipPipPipPip
  • 817 posts
  • Location:Boston, MA
  • Version:LabVIEW 8.6
  • Since:1999

Posted 23 April 2012 - 01:10 AM

Between the posts on the NI forum and here, I think everything the OP needs is available. Either the assignment is to learn that something is not feasible, or the instructor doesn't have a clue.

http://forums.ni.com...ol/td-p/1958549

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T


#24 Jordan Kuehn

Jordan Kuehn

    Extremely Active

  • Members
  • PipPipPipPip
  • 342 posts
  • Location:Oklahoma
  • Version:LabVIEW 2011
  • Since:2009

Posted 23 April 2012 - 05:19 AM

For GOD sake, this is my VI, please help me, i know TCP is better, but i just wanna see it working with UDP, so what shall i change to not see this error message anymore :(


You'll find that getting angry at people trying to help you here won't get you far, especially if it is a homework assignment and the goal is for you to figure it out on your own. I agree with Phillip, the information here + some Googling will get you where you need to go.
The Colex Group
Lead Software Engineer
Certified LabVIEW Developer

#25 rolfk

rolfk

    LabVIEW Aficionado

  • Premium Member
  • 2,223 posts
  • Location:Netherlands
  • Version:LabVIEW 2011
  • Since:1992

Posted 23 April 2012 - 05:33 AM

You are loading the ENTIRE FILE then trying to transmit (all 600MB presumably) in one go. To remove the error you need to send a maximum of 1500 bytes of the file A BIT AT A TIME by reading the first 1500 bytes, write that to the UDP port then reading the next 1500 bytes and write that .... and so on - a method of which I demonstrated to you in the image posted for bluetooth earlier (the code for which you can download from the Code Repository).

Short of writing it for you (and it is not my home-work), there is not a lot else I can tell you. Perhaps someone else can explain it better than I :rolleyes:


There is nothing wrong with your explaining skills! There are however people who do not want things to be explained to them but instead things being done for them. Or English is not the native language but the posts look pretty ok to me in grammar, so why someone with such a grasp of the language never has heard about "chunks" is beyond me.

Also while reading a file in chunks and sending it over UDP will probably work in a local network, I'm pretty sure the resulting file on the receiver end will be damaged after being transmitted like that over a more complex network infrastructure. That is unless one adds also packet sequencing code to the transmission (and in doing so more or less reimplements the TCP protocol on top of UDP).
  • moralyan likes this

#26 moralyan

moralyan

    Active

  • Members
  • Pip
  • 18 posts
  • Version:LabVIEW 8.5
  • Since:2011

Posted 23 April 2012 - 01:56 PM

my brother, i'm not angry :) i'm just beginner in labview and i don't have enough knowledge with it to understand exactely what my friends here are trying to explain for me, moreover, i mentioned earlier this is not a home work, it is rather a research, and if you google the term IEC61850, you will understand why we insist on UDP!!


There is nothing wrong with your explaining skills! There are however people who do not want things to be explained to them but instead things being done for them. Or English is not the native language but the posts look pretty ok to me in grammar, so why someone with such a grasp of the language never has heard about "chunks" is beyond me.

Also while reading a file in chunks and sending it over UDP will probably work in a local network, I'm pretty sure the resulting file on the receiver end will be damaged after being transmitted like that over a more complex network infrastructure. That is unless one adds also packet sequencing code to the transmission (and in doing so more or less reimplements the TCP protocol on top of UDP).

i knwo what "chunks" are, but how to build them in labview!!, i don't want people to do work for me, i just need some help :) i already said i'm not expert in labview, i have a good theoritical background with both TCP and UDP protocols, and in fact they are just a part in a larger research about IEC61850 standard.

#27 Götz Becker

Götz Becker

    Very Active

  • Premium Member
  • 136 posts
  • Location:Munich
  • Version:LabVIEW 2011
  • Since:2004

Posted 23 April 2012 - 04:37 PM

One way of getting the chunks could be:
chunks.png
  • moralyan likes this


#28 moralyan

moralyan

    Active

  • Members
  • Pip
  • 18 posts
  • Version:LabVIEW 8.5
  • Since:2011

Posted 23 April 2012 - 05:50 PM

One way of getting the chunks could be:
chunks.png

thank you, i hope this will solve the problem

#29 moralyan

moralyan

    Active

  • Members
  • Pip
  • 18 posts
  • Version:LabVIEW 8.5
  • Since:2011

Posted 23 April 2012 - 09:08 PM

wow, now it is working, but the received file seems to be corrupted due to packet duplication or miss-order, i tried to improve the performance using queues but i didn't get what i want, any suggerstions so far??

Attached Files



#30 rolfk

rolfk

    LabVIEW Aficionado

  • Premium Member
  • 2,223 posts
  • Location:Netherlands
  • Version:LabVIEW 2011
  • Since:1992

Posted 23 April 2012 - 10:15 PM

*
POPULAR

wow, now it is working, but the received file seems to be corrupted due to packet duplication or miss-order, i tried to improve the performance using queues but i didn't get what i want, any suggerstions so far??


UDP is not a reliable protocol. Unless you intend to do A LOT of extra error handling, packet sequence management, lost packet retransmission and what else, you can forget to use it for transfering a file that needs to stay consistent.
  • Phillip Brooks and moralyan like this

#31 Phillip Brooks

Phillip Brooks

    The 500 club

  • Members
  • PipPipPipPipPip
  • 817 posts
  • Location:Boston, MA
  • Version:LabVIEW 8.6
  • Since:1999

Posted 24 April 2012 - 01:23 AM

*
POPULAR

Decided to Google IEC61850 and UDP. I found this interesting PowerPoint presentation in PDF form.

http://www.pes-psrc....%2002282012.pdf

I liked the next to the last slide best:

The woods are lovely, dark, and deep:

After several weeks of research, the conclusions are:

  • Results are significant but not statistically so.
    • It is clear that UDP can be made reliable.
    • Packet loss was due to buffer issues and not network congestion.
    • Software architecture has an impact on buffer maintenance.
  • More discovery/research needs to be done regarding:
    • ?Optimum signaling for threads receiving UDP.
    • What is the interaction of buffering between VMs and the Host.
    • What is the impact of different NIC driver parameters on buffering/responsiveness.
    • Need for education (e.g. back to basics)



The author indicates that dropped messages are statistically insignificant. They were never able to eliminate them completely.

If you're just starting out with LabVIEW, this is going to take you some time, and I would wager that you will never achieve zero data loss using UDP.

Edited by Phillip Brooks, 24 April 2012 - 01:32 AM.

  • Mr Mike and moralyan like this

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T


#32 ShaunR

ShaunR

    LabVIEW Archetype

  • Members
  • PipPipPipPipPipPip
  • 2,604 posts
  • Version:LabVIEW 2009
  • Since:1994

Posted 24 April 2012 - 06:47 AM

*
POPULAR

wow, now it is working, but the received file seems to be corrupted due to packet duplication or miss-order, i tried to improve the performance using queues but i didn't get what i want, any suggerstions so far??


Really?
.........

UDP does not guarantee ordering, non-duplication or even delivery of "chunks", so you would need to make sure each write contains enough information to completely identify which part of which file it is. That way you could reassemble them on the other side. Even then you may not get them all, so probably want a way to ask for some part of the file to be resent.

These are things that TCP would take care of for you. Do you really need to use UDP?

Just read 65k bytes (or 1500 bytes is better for the reasons Rolf outlined) from the file at a time and write it using the UDP write. However. As GregR stated. It is not guaranteed to be recieved in the correct order, or indeed a chunk to be received at all! So that's not a lot of good for files, but usually acceptable for audio or video where a lost frame or two doesn't matter too much.

The easy solution, as others are saying, is to use TCPIP where all the ordering and receiving reassembly is handled for you (as well as other things UDP doesn't do out-of-the-box such as congestion control, re-transmission of lost packets etc). If you really must use UDP then you will have to code all that yourself (unless missing or incorrectly ordered file chunks is acceptable-for TDMS it wouldn't be). There are a few examples of reliable UDP (RDP). Noteably UDT and NORM. I am not aware of anyone doing this in Labview however, since it is just easier to use TCPIP.

And going beyond 1500 bytes MTU is only an option if you are on a controlled network where you do know about all routers involved between the two parties. Once you go outside of that, such as an internet connection, the maximum MTU is entirely out of your hands and going beyond the default of 1500 bytes is really playing chances that the communication will actually work, unless you do a lot extra work in reassembling the incoming packages into the right order on the receiving end. And that is something that is even on embedded devices usually handled much more efficiently by the TCP protocol level, so why go to the hassle of UDP in that case?


  • jcarmody and asbo like this

A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort. (Herm Albright 1876-1944).

Founder and general mischief maker on www.lvs-tools.co.uk.
SQlite aficionado and websocket zealot.
If it 'aint in LabVIEW, then you 'aint got a clue!


#33 rolfk

rolfk

    LabVIEW Aficionado

  • Premium Member
  • 2,223 posts
  • Location:Netherlands
  • Version:LabVIEW 2011
  • Since:1992

Posted 24 April 2012 - 08:18 AM

Decided to Google IEC61850 and UDP. I found this interesting PowerPoint presentation in PDF form.

http://www.pes-psrc....%2002282012.pdf


To me it looks like IEC61850 is not about transfering large files consistently over the network. To do that over UDP is really not a smart idea as you have to implement on top of UDP something similar what TCP does already for you.

An interesting side node to this: A while back I was looking at the network protocol used by Second Life and other compatible virtual world environments. They used to have the entire communication over UDP with their own sequence handling, acknowledgement and retransmission requests. The reason to go for UDP was supposedly the low overhead that was required to make movement and interaction in a 3D virtual world possible at all. However a few years ago they did introduce a new mechanisme for non-realtime critical messages and are porting slowly more and more of the messages over to this new mechanisme. It is basically a HTTP based protocol where the packet load is usually a data structure in their own LLSD format, which is in many ways similar to JSON.

And yes I have implemented some basic messages in LabVIEW that got me as far as logging into a virtual world server. :cool:
  • moralyan likes this

#34 drjdpowell

drjdpowell

    The 500 club

  • Premium Member
  • 751 posts
  • Location:Oxford, UK
  • Version:LabVIEW 2011
  • Since:1999

Posted 24 April 2012 - 09:44 AM

To me it looks like IEC61850 is not about transfering large files consistently over the network.

I googled it too and that was my conclusion. There were clearly tasks that cried out for UDP, broadcasting time-critical small pieces of information, but there was nothing suggesting one had to use UDP for sending large files.

#35 moralyan

moralyan

    Active

  • Members
  • Pip
  • 18 posts
  • Version:LabVIEW 8.5
  • Since:2011

Posted 24 April 2012 - 11:11 AM

Decided to Google IEC61850 and UDP. I found this interesting PowerPoint presentation in PDF form.

http://www.pes-psrc....%2002282012.pdf

I liked the next to the last slide best:




The author indicates that dropped messages are statistically insignificant. They were never able to eliminate them completely.

If you're just starting out with LabVIEW, this is going to take you some time, and I would wager that you will never achieve zero data loss using UDP.

Finally it seems like someone understands what is our focus from insisting on UDP, this is really encouraging; in fact our approach starts from the GOOSE model, we want to make UDP as reliable as possible by adding a small algorythm, just a light one to not decrease the speed of transfer. we have found that labview is the best tool to do so. IEC61850 is new standard that still needs a lot of work to be fully accepted in industry, we know it may look meaningless to insist on UDP, but at least, let's try :) this is the spirit


To me it looks like IEC61850 is not about transfering large files consistently over the network. To do that over UDP is really not a smart idea as you have to implement on top of UDP something similar what TCP does already for you.

An interesting side node to this: A while back I was looking at the network protocol used by Second Life and other compatible virtual world environments. They used to have the entire communication over UDP with their own sequence handling, acknowledgement and retransmission requests. The reason to go for UDP was supposedly the low overhead that was required to make movement and interaction in a 3D virtual world possible at all. However a few years ago they did introduce a new mechanisme for non-realtime critical messages and are porting slowly more and more of the messages over to this new mechanisme. It is basically a HTTP based protocol where the packet load is usually a data structure in their own LLSD format, which is in many ways similar to JSON.

And yes I have implemented some basic messages in LabVIEW that got me as far as logging into a virtual world server. :cool:

And this is the point my friend, we want to build anew UDP based protocol, you can say like UDT, to be used in power substations just like the GOOSE, i already said that i have a good theoritical knowledge with both TCP and UDP and the differences between them, however, i just don't know how to implement them using labview at the time my supervisor insists on using this programming language

I googled it too and that was my conclusion. There were clearly tasks that cried out for UDP, broadcasting time-critical small pieces of information, but there was nothing suggesting one had to use UDP for sending large files.

because you have just read what other people suggested for this new technology, IEC61850 is still under development, and the trend now is toward UDP based protocols, just look for more details about IEC and you will understand why we are insisting on UDP instead of TCP

#36 drjdpowell

drjdpowell

    The 500 club

  • Premium Member
  • 751 posts
  • Location:Oxford, UK
  • Version:LabVIEW 2011
  • Since:1999

Posted 24 April 2012 - 11:16 AM

just look for more details about IEC and you will understand why we are insisting on UDP instead of TCP

Could you explain why in a short paragraph, please?

#37 rolfk

rolfk

    LabVIEW Aficionado

  • Premium Member
  • 2,223 posts
  • Location:Netherlands
  • Version:LabVIEW 2011
  • Since:1992

Posted 24 April 2012 - 11:27 AM

And this is the point my friend, we want to build anew UDP based protocol, you can say like UDT, to be used in power substations just like the GOOSE, i already said that i have a good theoritical knowledge with both TCP and UDP and the differences between them, however, i just don't know how to implement them using labview at the time my supervisor insists on using this programming language


You haven't shown much so far that would have made me believe that you have much of a technical understanding of those protocols.

And wanting to do something is a nice thing, but if it is a useful exercise an entirely different one. Considering some notices in the paper about how the difference in calling socket functions can have a significant influence in lost buffers, I think LabVIEW might be not the ideal environment to tackle this research. You have no control whatsoever, in how LabVIEW handles the socket calls. In addition it adds it's own network data buffering that you can only influence in limited ways from the LabVIEW nodes. And no I'm not talking about controlling socket attributes by calling socket API functions directly, but how LabVIEW calls recvfrom() and friends itself.
  • asbo likes this

#38 Phillip Brooks

Phillip Brooks

    The 500 club

  • Members
  • PipPipPipPipPip
  • 817 posts
  • Location:Boston, MA
  • Version:LabVIEW 8.6
  • Since:1999

Posted 24 April 2012 - 12:50 PM

It seems that NI is in the process of developing drivers for IEC-61850.

http://forums.ni.com...1868231#M633636

Maybe you could contact your NI rep and get more info or help them test their driver..
  • asbo likes this

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T


#39 drjdpowell

drjdpowell

    The 500 club

  • Premium Member
  • 751 posts
  • Location:Oxford, UK
  • Version:LabVIEW 2011
  • Since:1999

Posted 24 April 2012 - 06:34 PM

UFTP is interesting as a UDP-based file transfer system (with the interesting use case of a broadcast to multiple receivers over a satellite link). moralyan should have a look.

#40 Götz Becker

Götz Becker

    Very Active

  • Premium Member
  • 136 posts
  • Location:Munich
  • Version:LabVIEW 2011
  • Since:2004

Posted 25 April 2012 - 05:08 AM

I still don't see why you want to build the file transfer on UDP, but I could imagine that if you know your packet loss rates and patterns, you could build a FEC (like RS codes) to counter the losses. At least it would be a fun thing to try ;)






Also tagged with one or more of these keywords: file transfer, udp