Main Site Documentation

Image transfer from PC to EMX


#1

Hello,
I need to transfer an image (size about 100k), from a PC to an EMX module. Both are network connected. What would be the most efficient way ?
I tried UDP but it is very slow due to ascii convertion and split to get small messages.
Any advise ?


#2

why do you need ASCII conversion? Just transfer it as a binary file. You could do that over HTTP


#3

why do you need ASCII conversion?
I was doing ASCII convertion because UDP only transport characters, so I had to convert an array of byte to a long string, then split it and send each piece over the net with UDP.

Just transfer it as a binary file. You could do that over HTTP
It is not very easy, my file is on a PC directory and so server runs on the PC.


#4

“I was doing ASCII convertion because UDP only transport characters”

Huh?

When you send with UDP, you send bytes not characters. Are you using some higher level library?

Why not use TCP?


#5

I’m sure you are right but how do you convert in VB an array of bytes to send it with the SendData mathod which takes Object ?


#6

What SendData method are you talking about?


#7

I was talking about SendMethod of the sockets in VB. But thanks to Mike, I transmitted the image with TCP which work very fine.
Actuelly I have a new question with TCP sockets how can we wait for the whole message to be arrived. socketTCp.Available gives the number of bytes already arrived but I would like to know the total number of bytes to arrive before using the socketTCp.receive method.


#8

You can always do it in two steps. First you send a message about image information (file size, dimensions, etc.) and then you transmit actual image. That way you know for sure how much data to expect.