Results 1 to 2 of 2
  1. #1
    abhijit is offline Member
    Join Date
    Sep 2009
    Posts
    24
    Rep Power
    0

    Default Connection not found

    Hi all,
    I'm trying to transfer file from my pc to mobile using bluetooth application
    take a look at my code

    public void serviceSearchCompleted()
    {
    try
    {
    System.out.println("First Line");
    Connection connection = Connector.open(UStr);
    System.out.println("Connection obtained");

    ClientSession cs = (ClientSession)connection;
    HeaderSet hs = cs.createHeaderSet();

    cs.connect(hs);
    System.out.println("OBEX session created");

    //System.out.println("Response code of the server after connect..." +hs.getResponseCode());

    File file = new File("C:\\AddImage\\ICICI_Advertisement.gif");
    InputStream is = new FileInputStream(file);
    byte filebytes[] = new byte[is.available()];
    is.read(filebytes);
    is.close();

    hs = cs.createHeaderSet();
    hs.setHeader(HeaderSet.NAME, file.getName());
    hs.setHeader(HeaderSet.TYPE, "image/jpeg");
    hs.setHeader(HeaderSet.LENGTH, new Long(filebytes.length));

    Operation putOperation = cs.put(hs);
    System.out.println("Pushing file: " + file.getName());
    System.out.println("Total file size: " + filebytes.length + " bytes");

    OutputStream outputStream = putOperation.openOutputStream();
    outputStream.write(filebytes);
    System.out.println("File push complete");

    outputStream.close();
    putOperation.close();

    cs.disconnect(null);

    connection.close();
    }
    catch(Exception e)
    {
    System.out.println("connection:"+e);
    }

    }



    it is trrowing the exception as:
    javax.microedition.io.ConnectionNotFoundException


    could anyone help me regarding this.........
    Last edited by abhijit; 09-23-2009 at 06:56 AM.

  2. #2
    giapvantinh is offline Member
    Join Date
    Oct 2009
    Posts
    2
    Rep Power
    0

    Default

    oh! i also have a proplem same you but with me,i send file sound .wav from a PC to mobile but i haven't successfull!.

Similar Threads

  1. data.txt not found
    By RedSix in forum Eclipse
    Replies: 4
    Last Post: 04-23-2009, 02:43 AM
  2. Web Application not found
    By adtd8 in forum JavaServer Pages (JSP) and JSTL
    Replies: 7
    Last Post: 07-28-2008, 02:05 AM
  3. GeoPoint Not found
    By nvidia in forum NetBeans
    Replies: 2
    Last Post: 05-28-2008, 09:31 PM
  4. 404 Not Found
    By mary in forum Java Servlet
    Replies: 5
    Last Post: 11-07-2007, 10:15 AM
  5. ConnectException not found
    By tamayo in forum New To Java
    Replies: 1
    Last Post: 07-23-2007, 08:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •