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.

Similar Messages

  • 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

  • Problem communicating via serial port in Linux

    Hello,
    I am trying to transfer data via serial port, in Linux.
    But it is impossible till now!
    I get Runtime exception.
    Here is my code:
    public class Main {
        public Main() {
        int num=5;
        int[] array = new int[5];
        public static void main(String args[])  {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    array[0]=1;
                    array[1]=2;
                    array[2]=3;
                    array[3]=4;
                    array[4]=5;
                    new ParallelCommunication(num,array);
    import java.io.*;
    import java.util.*;
    import javax.comm.*; // for SUN's serial/parallel port libraries
    //import gnu.io.*; // for rxtxSerial library
    public class ParallelCommunication implements Runnable, SerialPortEventListener {
       static CommPortIdentifier portId;
       static CommPortIdentifier saveportId;
       static Enumeration portList;
       InputStream inputStream;
       SerialPort serialPort;
       Thread readThread;
       static OutputStream outputStream;
       static boolean outputBufferEmptyFlag = false;
       int num;
       int[] array;
       public ParallelCommunication(int this_num,int[] this_array) {
          boolean portFound = false;
          String defaultPort;
          num = this_num;
         array=new int[this_array.length];     
          array = this_array;     
          // determine the name of the serial port on several operating systems
          String osname = System.getProperty("os.name","").toLowerCase();
          if ( osname.startsWith("windows") ) {
             // windows
             defaultPort = "COM1";
          } else if (osname.startsWith("linux")) {
             // linux
            defaultPort = "/dev/ttyS0";
          } else {
             System.out.println("Sorry, your operating system is not supported");
             return;
    //      if (args.length > 0) {
    //         defaultPort = args[0];
          System.out.println("Set default port to "+defaultPort);
          // parse ports and if the default port is found, initialized the reader
          portList = CommPortIdentifier.getPortIdentifiers();
          while (portList.hasMoreElements()) {
             portId = (CommPortIdentifier) portList.nextElement();
             if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                if (portId.getName().equals(defaultPort)) {
                   System.out.println("Found port: "+defaultPort);
                   portFound = true;
                   // init reader thread              
                   initialize();
                   break;
          if (!portFound) {
             System.out.println("port " + defaultPort + " not found.");
       public void initwritetoport() {
          // initwritetoport() assumes that the port has already been opened and
          //    initialized by "public void initialize()"
          try {
             // get the outputstream
             outputStream = serialPort.getOutputStream();
          } catch (IOException e) {}
          try {
             // activate the OUTPUT_BUFFER_EMPTY notifier
             serialPort.notifyOnOutputEmpty(true);
          } catch (Exception e) {
             System.out.println("Error setting event notification");
             System.out.println(e.toString());
             System.exit(-1);
       public void writetoport(int counter) {
          try {
             // write string to serial port
             outputStream.write(String.valueOf(array[counter]).getBytes());
          } catch (IOException e) {}
       public void initialize() {
          // initalize serial port
          try {
             serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
          } catch (PortInUseException e) {System.out.println("Port In Use.");}  //******Here is the Exception******
          try {
             inputStream = serialPort.getInputStream();
          } catch (IOException e) {}
          try {
             serialPort.addEventListener(this);
          } catch (TooManyListenersException e) {}
          // activate the DATA_AVAILABLE notifier
          serialPort.notifyOnDataAvailable(true);
          try {
             // set port parameters
             serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
                         SerialPort.STOPBITS_1,
                         SerialPort.PARITY_NONE);
          } catch (UnsupportedCommOperationException e) {}
          // start the read thread
          readThread = new Thread(this);
          readThread.start();
       public void run() {
          // first thing in the thread, we initialize the write operation
         initwritetoport();     
         for(int i=0; i<=num_of_inputs; i++) {
            // write string to port, the serialEvent will read it
            writetoport(i);
         serialPort.close();     
       public void serialEvent(SerialPortEvent event) {
          switch (event.getEventType()) {
          case SerialPortEvent.BI:
          case SerialPortEvent.OE:
          case SerialPortEvent.FE:
          case SerialPortEvent.PE:
          case SerialPortEvent.CD:
          case SerialPortEvent.CTS:
          case SerialPortEvent.DSR:
          case SerialPortEvent.RI:
          case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
             break;
          case SerialPortEvent.DATA_AVAILABLE:
             // we get here if data has been received
             byte[] readBuffer = new byte[20];
             try {
                // read data
                while (inputStream.available() > 0) {
                   int numBytes = inputStream.read(readBuffer);
                // print data
                String result  = new String(readBuffer);
                System.out.println("Read: "+result);
             } catch (IOException e) {}
             break;
    }...and the outcome is :
    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:
    Error opening "/dev/ttyS0"
    tcgetattr(): Input/output error
    at com.sun.comm.LinuxDriver.getCommPort(LinuxDriver.java:66)
    at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:369)
    at ParallelCommunication.initialize(ParallelCommunication.java:128)
    I have searched a lot and I couldn't find a solution.
    Thank you.

    I'm having the same problem this helped somewhat debug the problem
    http://bloggerdigest.blogspot.com/2006/11/linux-serial-com-port-diagnostic-test.html
    I'm running Suse 10.3 and apparently it does not recognize my serial ports. So before
    you can test your Java code you have to figure out how to make linux see the ports.
    If I find a solution I'll let you know but if you find one first let me know. Thanks.

  • How to transfer file from PC to PC via serial port using labview

    I need to transfer files(.txt, .doc, .xls) from PC to PC via serial port using LabVIEW. Is it possible to transfer files, if so how to transfer?
    Solved!
    Go to Solution.

    Yes, it is possible to transfer files with the serial port using LabVIEW.  Files are just collections of bytes and the serial port is pretty good at shipping bytes from one PC to another.  You need to connect the serial ports together with a null modem cable.
    First, take a look at the example for serial communication.   In LabVIEW, go to the Help menu and select "Find Examples...".  From there you can search for "serial" or navigate to Hardware Input and Output >> Serial.  Select the "Basic Serial Write and Read.vi".  Experiment with that example to gain confidence on the serial communication methods.
    Next, it's time to learn about how to read and write files.  For that, the examples could be somewhat confusing since they all deal with files that are presumed to have data of a specific type in them.  I would recommend just getting familiar with the functions on the File I/O palette.  Specifically, get to know the following functions.
    Open/Create/Replace File - On your destination side, you'll need to create the copy of the file that you are trying to transfer
    Close File - When you are finished reading from or writing to a file, you should close it.  It cleans up the memory being used and finalizes any write operations that are still floating in the write buffer.
    Read From Binary File - The best way to read from a file when you do not really care what type of file it is.  In your case, you just want to get those bytes read and sent out so they can be written down at the destination.
    Write to Binary File - At the destination side, this is what will store those bytes to the file you created with number 1.
    Get File Size (under the Advanced File Functions sub-palette) - You need to know how big the file is so you know when you are finished.
    OK, so once you are able to create files, write bytes to them, and read bytes from existing files you can move on to transferring.
    The basic method I would suggest is to have the user specify a source file on the source PC and a destination folder on the destination PC.  Then, find out the size of the source file using number 5.  Divide that size number by the number of bytes you feel like transferring at once.  The serial buffers are usually around 32k (if I remember correctly) so do not exceed that.  Now begin sending data by reading some number of bytes and wiring that string output to the VISA Write function.  On the destination side, you'll want to be monitoring the serial port for bytes and reading them when they arrive.  Wire that string to the Write to Binary File function to add them to your destination file.
    That is the basic outline of how to do it.  You have to be careful not to overload the write and read buffers on the serial ports.  Initially you can use delays on the sending side to make sure the reading side has enough time to digest.  To get things moving faster, you can bring in some flow control.
    If all that sounds a bit intimidating, there are Alliance Member companies out there (such as PrimeTest Automation) who can write such code for you and even provide a turnkey solution for you.
    Happy wiring,
    Dan Press
    Certified LabVIEW Architect
    PrimeTest Automation

  • How can i browse FP 2000 via serial port same use Ethernet port(RJ 45)?

    I am a new user for  labview.I develope my program with FP 2000 but I have some problem
      1 How can i browse FP 2000 via serial port same use Ethernet port(RJ 45)? if it can Tell me please.
      2 If  I use GSM/GPRS modem via FP 2000 rs 232 port (I under stand how to send AT command) and leave it stand alone
         Can I dial modem and browse file in FP 2000 same as use Ethernetport?
    Someone please help me.Thank you very much.

    Hi!
        First, I can say that your project involves many things, I cannot describe all features in the forum, and I'm not used with GPRS modems (my modems are base band serial modems...).
        Anyway, I would say that in your project you should proceed like this:
          1) Configure your FP 2000 module via MAX and ethernet connection;
          2) Download an embedded application to your module (build in LabView Real-Time)
          3) In your application, you should build a kind of serial port manager, and by the means of serial port you send/receive commands from PC.
        The commands from PC can include "Tell me the about the FP 2000 file system ", or "switch on line X", or anything you need.
       I think it would be difficult to use Internet exp, because you use IE with TCP/IP, and TCP/IP is over ethernet.
       I know that for Windows you can find some wrappers that make you "see" the serial port as an ethernet, but these wrapper do not exist under filed Point, and you shoul build one yourself!!!(and that's not easy).
        For example, to browse your files, you should build a VI that searches through your file system, and reports, via serial, the files present in a directory (it's an example....).
        About communication between GPRS modems and FP2000, I know nothing.  I suppose that these modems accept serial inputs, so you'll have to configure your serial port on FP 2000 with the correct baud rate, parity, and so on..... and you send your data to the modem.  The modem will transfer data in its way, no matter on how it does.
        To send data to your modem you shoud take a look to some Serial communication examples.  What I suggest you, first, is to connect the serial port of FP2000 to a PC, and test communication between PC and FP2000, without modems. Just direct cable connection!  If you're able to do this, insertion of modems is the next step, and should be quite easy.  If you're not able to make the PC receive strings of data from FP2000, over  RS232, adding modems is a further complication, and you won't come out of this mess!
       So, what I say, is just build, for now, a simple embedded application for FP2000, that, using RS232, sends data to a PC (you should see data sent with use of Hyper terminal).
        To build this application, use Instrument I/O --> VISA commands (VISA open, VISA write, and Property node should be enough, for now).
       Please, let me know if this helps......
        Have a nice (programming) day!
    graziano

  • Can u transfer files via airdrop from a iphone 5 to a mac and vice a versa

    hi,
    can u transfer files via air drop from an iphone 5 to a mac air, and mac air to a iphone 5.

    I would like a constructive response, rather than an ascerbic one.
    We have owned Iphones for a couple of years, and used photostream to copy photos to a PC...
    Within the family, we have 2 ipod touch, 2 x iphone, 2 x ipad minis and 2x Ipad Air.
    I have recently purchased a Mac desktop and would like to use this as a central backup and storage for all devices.
    I have been made aware that photostream / Icloud will only do its thing and back up to the Mac whenever the designated account is open on the Mac. (so I must remember to ensure the account for each family member is opened at lease once a month)
    SO, on one of the iphones, for example, we have over 900 photos in the photostream album. When connected to the Mac, only the last 30 days of photos are copied across (about 60 photos).
    How can I transfer across the other 850 photos ?
    I cannot copy them across to the camera roll on the iphone
    I cannot access them from iphoto
    the camera does not show itself as an " external drive" in Finder (Please note I am more acustomerd to using a PC).
    Itunes only allows "sync" and "backup" of the phone but is not at all helpful. (No indication of what is is/has backed up or synced)
    My Icloud is currently holding 12gb of my data, but the only info I KNOW is in the Icloud is my next dentist appointment.
    I really wish to transfer these photos across, as I would also like to upgrade the ios software, but this needs a few gb of memory space, and, of course, the
    These photos are visible within the iphone, but how do i get them transferred???
    like I said at the beginning, constructive answers please.

  • 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.

  • Export CDR via serial port

    The hardware platform is Cisco UCSC-C220-M3SBE, the Call Manager version is 8.6.2.22900-9.
    We manage to export the CDR to a sftp server. However, the bill system vendor requests us to export the CDR via serial port. 
    Is it possible to do it onto our platform in this case?

    On CUCM no, but with CME it can be done (by collecting syslog output). Otherwise you may exploit the CDRs on the voice gateway.
    It's not everytime that CUCM offers the required feature!

  • Connection Siemens TC65 to PC via serial port

    I don't connect Siemens TC65 via serial port . How can I do this? How can I upload java code in tc65..
    Is there anyone to solve this problem?

    tajava
    Welcome to the forum. Please refrain from posting in old threads that are long dead. When you have a question, please start a topic of your own. Feel free to provide a link to an old thread if relevant.
    I also suggest you go through these links before posting again:
    [How to ask questions the smart way|http://catb.org/~esr/faqs/smart-questions.html]
    [How To Get Good Answers To Your Questions|http://www.tek-tips.com/viewthread.cfm?qid=473997]
    I'm locking this thread now.
    db

  • RMI via serial port.

    I would like to use RMI via serial port.
    How can I do that?

    Thanks for the reply
    I can get it sending bytes of info from one machine to
    another but not to sure how I still send an object
    Wy do you think I should'nt be sending an object using
    rmiOK, if you have a setup working that involves writing bytes to an OutputStream at one end, and reading bytes from an InputStream at the other, then all you need to do is create an ObjectOutputStream at one end, and write the object to it.
        ObjectOutputStream oos = new ObjectOutputStream(myOutputStream);
        oos.writeObject(myObjectToSend);
        oos.close();and at the other end an ObjectInputStream:
        ObjectInputStream ois = new ObjectInputStream(myInputStream);
        MyObjectType myObjectToReceive = (MyObjectType) ois.readObject();
        ois.close();That should pretty much do it.
    The reason you should not be using RMI for this is that it relies on the existence of a netork layer that connects the two machines. PPP would have provided that, but there just doesn't seem a justification for that level of complexity here.
    Sylvia.

  • How do I transfer files via the thunderbolt cable

    How do I transfer files via the thunderbolt cable. 

    Like you would with any other cable. What are you connecting together?

  • Laptop G400S Windows 7 cannot transfer file via bluetooth to cellphone

    Dear all,
    I just bought the above laptop but found difficuties to transfer the file via bluetooth either to LG or Samsung cellphone.
    The laptop can easily paired with two gadgets but when I try to send something it will say:
    "Windows was unable to transfer some file. A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host failed to respond".
    Anybody can help please.
    Thanks,
    Ari

    mbellot wrote:
    I'm not sure if this will help you or not...
    I did some additional testing today and "fixed" my problem.
    I grabbed a new (almost fresh install of XP) laptop and installed a Jabra USB BT dongle with the MS BT Stack. Then I installed DM 5.0.1 and plugged the phone into a USB port to get it past the initial configuration.
    Unplugged the BB from USB, went into Device Manager, enabled BT and searched for a new device. It forund the 8350i and finished pairing. Switch from USB to BT connection and DM5 could communicate with the phone (same as the original laptop).
    Went into "Media" and selected "Receive using Bluetooth" while starting a file transfer from the PC. Transfer went through without a hitch. Tried it several more times without any problems.
    Back to the old laptop, I switched off the wireless devices (WiFi and BT) and installed the Jabra adapter. Paired it with the phone and tested, transfers from the PC to the phone now work.
    Unplug the Jabra and re-enabled the internal BT on the laptop, file transfers fail again.
    Same computer, similar BT (both Broadcom), one works and one doesn't. I'm left wondering if there isn't some remnant of the original ThinkPad BT Stack buried somewhere (registry?) that is interfering with the internal adapter.
    My next step will be to install a clean copy of XP on a new HD in the "problem" laptop and see if I can get it working. If I can then that pretty much proves there is something left over or corrupt in the current OS.
    i'm going to uninstall drivers from the problematic VAIO...try installing the same drivers as i have on the Acer (working) and see if this resolves anything as I think it may have something to do with the WIDCOMM...
    after inspection you should have 2 bluetooth radio device drivers and 2 RIM serial port drivers (4 & 5 i believe)...last time i tried doin it and installed 4 RIM drivers...

  • Getting a G4 and MacBook Pro to transfer files via ethernet

    Thank you for the help on setting up file sharing. File sharing looks to be working on both computers (now) but it prompts a new question: I now have a problem with the ethernet connection. I unlugged my cable modem ethernet cable and connected it to the ethernet port on the back of the G4 and to the MacBook Pro ethernet slot (as recommended in Mac Help). I opened File Sharing in both computers. I've followed the steps in Mac Help to get the MacBook Pro to recognize the G4 so I can start transfering files to the MBP. No success getting them to "see" each other.
    It appears that the MacBook Pro wants me to do it over the Internet but Mac Help is telling me I can do it directly from computer to computer since I've got them connected via the ethernet cable. (Step 3. is "connect to server" and, once connected, there is a "browse" option). My hope is to use the G4 as the "server" but I can't determine how to make the MBP connect to the G4 so I can transfer files. (each computer has a different name.)
    Any suggestions are appreciated.
    Thank you.
    PowerMac G4 Mac OS 9.2.x MacBook Pro 17" laptop 2.16 GHz, 2 GB 667 MHz DDR2 SDRAM

    Thanks for the suggestion. In following your recommendation I get a window on my MBP that says, "Connection failed. The server may not exist or it is not operational at this time. Check the server name of IP address."
    In trying to "connect," I've inserted the ethernet cable into the port on the MBP and the G4. So, I'm not connected to the cable modem. Since there is only one ethernet port on each computer, that seemed sensible. Maybe not.
    On the MBP I also tried, in the Sharing folder under "Internet," there is an option to share my built-in MBP ethernet connection with the built-in G4 ethernet. When I tried that a message popped up saying, "if you turn on this port, your ISP might terminate your service to prevent you from disrupting its network. In some cases (if you use a cable modem - which I do - you might unintentionaly affect the network settings of your ISP and violate the terms of your service agreement."
    On the G4 I've enabled file sharing and enabled file sharing clients to connect over TCP/IP.
    I don't know if this is relevant, but my TCP/IP on the G4 is configured to connect via Ethernet and configure using DHCP server.
    Thank you.
    The most consistent way I have found, is to use the
    IP address. The Browse function should work, but
    sometimes it does not.
    If you want to connect from the MBP to the G4 (G4's
    volume shows up on MBP desktop), you need to know the
    IP address of the G4. Go to the TCP/IP control panel
    (on the G4). You should see the G4's IP address
    there. Note it down.
    On the MBP, go to Menu -> Go -> Connect to Server...
    as you have already done. Instead of hitting the
    Browse, just type in that IP address where it says
    Server Address. Now hit the Connect button.
    You should be prompted for user name and password for
    the G4.
    PowerMac G4 Mac OS 9.2.x MacBook Pro 17" laptop 2.16 GHz, 2 GB 667 MHz DDR2 SDRAM

  • 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

  • How to transfer files via WiFi from a PC to a C7.....

    Hey guys. Please help me. I want to transfer files from my PC to nokia C7 via wifi. But i am unable to find any source. I remember home sharing options in Nokia N82 but couldn't find anything similar in a C7. I'll be really thankful to you if you help me. 
    Solved!
    Go to Solution.

    Try Dukto, a small application for file sharing on howm wi-fi networks. You need to install both PC and phone utility. Application is available on the Ovi store.
    If a reply has solved your problem click Accept as solution button, doing it will help others know the solution. Thanks.

Maybe you are looking for