Sending File Over Serial PORT

Hi,
I'm able to read/write data over serial port using Java Comm APIs in Linux.
Can anybody please tell me how to write/read a file over Serial port?
Is it similar to sending a file over network?
An early response is appreciated...

Same stream I/O as used over the port works from a file. Dead simple.
Also dead slow. If you want to do large amounts of data, use a RandomAccessFile and read a big chunk at a time into a byte array. Then send the byte array.

Similar Messages

  • Download Binary Data File over Serial Port

    I need help setting up a .vi that I can use to download a binary data file from a dos-based system. I will send the system a command, say ascii "DOWNLOAD", and then the remote system will send me a binary data file that will be approx. 600MB. I won't be doing any display/manipulation using labview, I will just need to have the option available in LV to recieve the file.
    Any examples would help a programmer that is new to LV and is getting a little desperate.

    A VISA Read doesn't care whether the data it's getting is binary or ASCII. Where you might have problems is detecting that file transfer is complete. If you have enable termination character set to True in the VISA Configure Serial Port, the read will stop as soon as the termination character is detected. The default termination character is 0xA or a linefeed. You probably don't want to use this. If the file is terminated with a character or string of characters that you now will be unique, you can use this. If there is no unique termination character at the end of the file, the next best thing is to know the file size exactly and set the byte count of VISA Read to that number. Based on file size and baud rate, you would also need to adjust the VISA timeout value. Another way to do this is to transfer the data in pieces and write to a file as soon as the data is received. The reading of data would then be terminated when there are no more bytes available at the serial port. I've attached a LabVIEW 7.0 program that should give an idea of the last approach.
    Attachments:
    File Transfer.vi ‏57 KB

  • Send file to serial port using comfromfile

    Hi,
    I am current working on a project with requires to transfer a bin file to the controller, if the file is valid i will get the correct respose.
    if we send a file in hyperterminal using send text file option i am getting response from the controlller as file valid.
    I want to send a file through the code i used comfromfile function i am getting invalid file reponse from the controller even i tried byte by byte with comwrtbyte also i received the same invalid response..
    I cross checked the rs232 configuraiton of both hyperterimal and my code..both are same..even i checked with port sniffer tool to capture the port data..both are same.
    I am not able to find what is the issues with my code. what is the differece in the Hypertemail and CVI functions..
    Regards
    Vikram Kumar P

    Thank you for your support....
    As per policy i cant share my complete code..
    whatever eariler shared code is a part of my application code where the binary data is transfered..there is no issues with formating reading coping.
    I checked the serial data variable before sending the data is correct what expected to send.
    I tried all the serial functions comwrtbyte, comfromfile, comwrt & visa functions..the same behavior is received
    please find the attachment of catured data from portman tool.
    attached 3 files
    hyperterminal captured data - I am getting valid response from controller
    cvi exe captured data - I am getting failed response from controller.
    binary data - downloadable binary file to a flash memory using the RS 232 communication system
    Attachments:
    With CVI applicatoin exe.LOG ‏44 KB
    With hyperterminal.LOG ‏44 KB
    Binary data to transfer.txt ‏1 KB

  • How send data to serial port from forms 6i

    How send data to serial port to activate hardware connect.
    The hardware is a drawer for cash the point of sales.

    Andres,
    I do the exact thing you are looking for,
    I spool out a text file using text_io
    the file will either contain a double ^G or an epson escape sequence, depending on the drawer type connected.
    I then copy this file to the port using a copy function id d2kwutil
    Works perfectly, but god knows how I'll do it if we want to run the point of sale over the web :)
    John

  • Files via serial port

    I need to send a jpg file via serial port. Have anyone an idea how to get it. I am using LabView 6.0.

    Hi Francesc,
    In order to solve this you will need:
    - a null modem cable (the difference is that pin 2in goes to pin 3out and pin 3in goes to pin 2out)
    - a normal serial communication VI (you can use the one in lv\examples)
    - to pass the data you have to transform your array of bytes (your file) in string at sender and reverse this operation at receiver. THE ONLY PROBLEM is with ASCII character 11 (even if the receiver has all your bytes in buffer it seems that will return to you just those before ASCII 11). Thus, you will have to avoid the transmission of this character. An idea will be to split each byte from file in other two for transmission - for example its hex code (so, 11 will be transmitted as 0B ). Of course, this method doubles the number of transmit
    ted bytes. If somebody found a better solution, please let me know.
    good luck

  • Why i can't make a normal video call over my cellular operator using by iphone 4s ????!!!! is it possible that if my mobile is iphone so i can not contact (Video Call - or Send Files over Bluetooth ) people do not have iphone ??????!!!!!!!!!

    why i can't make a normal video call over my cellular operator using by iphone 4s ????!!!!
    is it possible that if my mobile is iphone so i can not contact (Video Call - or Send Files over Bluetooth ) people do not have iphone ??????!!!!!!!!!
    i'm still looking for solution, but if i there is no solution so i will throw My Own iPhone 4S in the nearest Trash.
    (I had got a big problem and thanks for Nokia saved me. and if i don't care about apple products i will never send to you this, so kindly find solution or people in middle east will stop using iphone)

    No clue why you cannot make video calls over your cellular operator... have you tried contacting them?
    If you're referring to FaceTime, it is currently limited to Wi-Fi only.
    Sending files via Bluetooth is not a supported feature of the iPhone or iOS.  A simple search of the web or these forums would have made that abundantly clear.
    Threatening to throw away valuable items in these forums only serves to make you look less than intelligent.  No one here is an Apple employee, we are all users like yourself.  As such, we could care less what you do.  If you choose to be stupid, that's up to you.
    Educate yourself and stop whining.

  • Problem with Sending files over Sockets

    Hi. I have a problem when I try to send files over sockets. When I send text files it works well but when I try to send .jpg or other kind of files it doesn't work well because some characters are wrong, I hope you can help me.
    Here is my code:
    //Sender code
    import java.io.*;
    import java.net.*;
    class Servidor{
         Servidor(){
              try{
                   String arch="art.jpg";
                   ServerSocket serv=new ServerSocket(125);
                   Socket socket=serv.accept();
                   System.out.println("Conectado");
                   int c;
                   BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
                   FileInputStream fis=new FileInputStream(arch);
                   File f=new File(arch);
                   bw.write(""+f.length());
                   bw.newLine();
                   bw.flush();
                   System.out.println("Escribiendo");
                   while((c=fis.read())!=-1){
                        bw.write(c);
                   bw.flush();
                   fis.close();
                   System.out.println("Terminado");
                   while(true){
              }catch(Exception e){
                   System.out.println(e);
         public static void main(String arg[]){
              new Servidor();
    //Client code
    import java.io.*;
    import java.net.*;
    class Cliente{
         Cliente(){
              try{
                   Socket socket=new Socket("localhost",125);
                   System.out.println("Conectado");
                   BufferedReader br=new BufferedReader(new InputStreamReader(socket.getInputStream()));
                   long tam=Long.parseLong(br.readLine());
                   long act=0;
                   FileOutputStream fos=new FileOutputStream("resp.jpg");
                   System.out.println("Recibiendo: "+tam);
                   while(act<tam){
                        fos.write(br.read());
                        act++;
                   System.out.println("Terminado: "+act+" / "+tam);
                   fos.close();
              }catch(Exception e){
                   System.out.println(e);
         public static void main(String arg[]){
              new Cliente();
    }

    I don't think you want BufferedReader and OutputStreamWriter, you want ByteArrayOutputStream and ByteArrayInputStream . The problem is that you are sending jpegs (binary data) as text.

  • Send signal to serial port

    Hi, I have a trouble.
    I need to send a signal to serial port to pilot a relè.
    I can't find how to send a Vcc signal for some second on a pin in java.
    Someone have an idea?
    Thanks a lot!
    Edited by: Alberto.Marcigaglia on Aug 29, 2008 2:27 AM

    There are many results from the search below:
    http://www.google.com/search?q=java+serial+port
    I suggest that you use the 3-rd party RXTX package rather than the obsolete javax.comm package. There are a number of very detailled posts in these Sun forums regarding the installation and use of RXTX - search for them.

  • Sending Files over a Windows Network

    I am trying to send files from one computer to the other over a windows network. I have absolute path names of the two locations.
    Can you just use "File.renameTo(File);" to pull this off?
    Is there a fast way to move files over a windows network?
    Thanks so much for your help

    With File.renameTo()? Yes.
    between directories on different local drives? Yes.
    or different nodes in a network?I'm not sure what you mean by that, which is most probably my lack of knowledge about computer networking.
    Here's the test I performed:
    File a = new File("C:/Temp/test.txt");
    // 'E:' is (physicaly) a different hard drive than 'C:'
    File b = new File("E:/Temp/test.txt");   
    System.out.println(a.renameTo(b));
    // 'Athene' is a home-SAN-drive/server connected to my router
    File c = new File("//Athene/SHARE/Temp/test.txt");
    System.out.println(b.renameTo(c));Both print true and in both cases I have checked to see if the files really were moved, which was the case.

  • How can i send file over messages in Mac OS X?

    Hi,
    Unable to send files from messages application in my Mac, i configured gmail account in messages so u can able to chat with my friends but i can't send any file to my friends. so is there any setting needs to be configure in preferences? please suggest me.
    Thanks in Advance,
    Suresh Balakrishnan.

    HI,
    In iChat 6 before you upgraded to Messages Beta were you able to Send Files ?
    There are also various ways to start this
    Try:-
    Dropping a file on a Buddy's name in the Buddy List
    Dragging a File to the text entry field in a chat.
    In a Video Chat drag a file over the Chat window and chose the half that says  Send File.
    As it is Google are you Buddies logged in via the Web Browser or a Jabber App or iChat on a Mac ?
    9:16 PM      Wednesday; March 28, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.3)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • Want to use dotNet with teststand, but unsure how to send commands through serial port

    I have a loCom communication dll used to send and recieve commands through serial comunication for a particular product.  I the past they have used a LabVIEW wrapper to send and recieve commands, using this particular dll.  I would like to just use testStand for the DOTNET Dll.  I can get the commands, know the inputs and outputs required, however I can not figure out how to send the commands to the serial port.  Anyone have any exprience doing this in TesSTand?

    hallawt,
    With your .NET code module, you should be able to call it directly, most likely as a parameter in the .NET method.
    What are the inputs for the method you're trying to use?
    Also, could you clarify where you're starting to have problems in your project?
    Regards,
    Renée M
    Applications Engineer
    National Instruments

  • Using Flyer to send files over a Bluetooth connection

    import mx.utils.Delegate;
    import com.flyer.Bluetooth;
    var connection_str:String = “127.0.0.1″;
    var port_num:Number = 9100;
    var connection_bt:Bluetooth = new Bluetooth();
    var filePath_str:String = “E:\\photo_001.png”;
    function sendFile():Void {
    connection_bt.connect(connection_str, port_num);
    status_txt.text = “Connecting to Python…”;
    function onBluetoothConnect(success_bool:Boolean):Void {
    if (success_bool) {
    status_txt.text = “Sending file…”;
    connection_bt.send(”sendFile” + “|”
    + filePath_str);
    } else {
    status_txt.text = “Connection failed.”;
    function onBluetoothData(source_str:String):Void {
    status_txt.text = source_str;
    function onBluetoothClose():Void {}
    connection_bt.onData = Delegate.create(this,
    onBluetoothData);
    connection_bt.onConnect = Delegate.create(this,
    onBluetoothConnect);
    connection_bt.onClose = Delegate.create(this,
    onBluetoothClose);
    sendFile()

    is is possible to use a filestream to send files from
    client to server? If so could someone show me some
    example code or point me to a good internet
    reference. i have done some searching and reading
    but haven't found anything that showed it well.
    thanks for the help in advance.The API descriptions for the 2 filestream classes gives the answer:
    FileInputStream - A FileInputStream obtains input bytes from a file in a file system.
    FileOutputStream - A file output stream is an output stream for writing data to a File or to a FileDescriptor.

  • Transfer files via serial port

    Hello there
    I am final year programming student
    and I have to analyse transferring data from one pc to
    another via the serial port.
    I guess I would have to use the communications api.Does anyone know if there is an example of this already developed.
    Please reply
    Thanks

    Yeah. This is the steps you would take:
    1. Brew a can of coffee. (Or tea, if you prefer that.)
    2. Power up your computer.
    3. Sit down in front of your computer
    4. Code.
    5. Drink coffee (or tea.) Repeat 1 when the pot runs empty.
    6. Code some more
    7. Code even more.
    But no, I can't tell you how the code should be. It's not something I know much about. And I wouldn't have done it anyway, you say you are a final year programming student, it's about time you start doing your own programming.

  • VISA error when trying to read hex data over serial port

    Hi - Sorry about this. I am posting this question as a new thread as I am still having serious problems and may be able to shed more light now.
    Basically I am trying to read data formatted as a string of comma separated hexadecimal words over the serial link.
    The data is formatted thus:  <first word>,  <second word>, <third word> etc.... <last word, <CR>  where <CR> is a carriage return.
    Where each word represents a number, e.g.  AB01 is 43777 in decimal.
    Now the VI is stalling at VISA close (I attach VI again to this message), the string data is read across by the VI but it will not then close the link unless I remove to USB cable from the comms port.  When I run the device in hyperterminal I do not have this problem.  The data sting comes back fine (when I send out the command message), the carriage return is recognized as the end of the data message and the comma channel is cleared and ready to accept the next command message.
    LabVIEW is then not happy.  I don't know why but it could be that the amount of data the demo device I have is sending back is more than the NI-VISA can cope with.  Am I correct in thinking 13kbytes is the maximum.  If this were the case This would account for my problem.  It seems that the number of bytes read by the VI is consistently 12999.
    Hope someone can help or this information will at least be useful to somebody so they don't have this problem.
    Many Thanks
    Ashley.

    Yes there is. If your data contains data from 0x00 to 0xFF then you have to disable the 'termination char' in the VISA configure function. The boolean input at the top. Set it to false. Otherwise your transmission will stop at 0x0A by default. You can also tell what the termination character should be, if you want.
    btw. Still no VI attached. 
    Sorry replied to the wrong message. No I did not where are both replying at the same time
    Message Edited by K C on 12-08-2005 12:44 PM
    Message Edited by K C on 12-08-2005 12:46 PM

  • Slow to send files over airport extre and msn(amsn)

    Hi!
    When trying to send or recieve files on msn or amsn it is very slow...got 10mb connection but it sends and recievs at only 4kb (modemspeed)...
    And it is only over msn i got the problem...if i download over the internet the speed is aroung 800kb/s...
    Is it a firewall problem? Please help...
    andy
    i have a macbook pro and an extreme basestation

    When trying to send or recieve files on msn or amsn
    it is very slow...got 10mb connection but it sends
    and recievs at only 4kb (modemspeed)...
    And it is only over msn i got the problem...if i
    download over the internet the speed is aroung
    800kb/s...
    Is it a firewall problem?
    No it can't!
    This is either a software or server problem.
    dan

Maybe you are looking for

  • Help, an app page has frozen on my IPad Air!

    So this would be a bit confusing to understand. So I'm gonna explain everything clearly from the beginning. I was reading a story on my IPad Air with the app, Wattpad. When I wanted to exit, I pressed the home button, but then something just happened

  • DME Bank Data

    Hi All, Once we run the Payment program F110, we are downloading the file from DME and sending that to the bank. How does the Bank utilist this DME file and what are the contents that we send in this DME file? Is there any configuration that we do to

  • Getting pics from iphoto to pc

    I bought the connector that makes it possible to put pictures directly on my ipod from my camera. Now I can't get them onto my PC. Please help!

  • Mobileme

    OK, so i've just had a nice Sony A350 DSLR delivered and also got a trial of Aperture. I've referenced all my iphoto events over and all seems OK. I'm wondering now if I should fully migrate over to Aperture but cannot see a way of getting my mobilem

  • 8.0.2 is supposed to fix the flash

    but instead theres no flash at all. http://gest.atspace.com. any solutions?