Results 1 to 2 of 2
Thread: Connection not found
- 09-23-2009, 06:50 AM #1
Member
- Join Date
- Sep 2009
- Posts
- 24
- Rep Power
- 0
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.
- 10-01-2009, 11:53 AM #2
Member
- Join Date
- Oct 2009
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
data.txt not found
By RedSix in forum EclipseReplies: 4Last Post: 04-23-2009, 02:43 AM -
Web Application not found
By adtd8 in forum JavaServer Pages (JSP) and JSTLReplies: 7Last Post: 07-28-2008, 02:05 AM -
GeoPoint Not found
By nvidia in forum NetBeansReplies: 2Last Post: 05-28-2008, 09:31 PM -
404 Not Found
By mary in forum Java ServletReplies: 5Last Post: 11-07-2007, 10:15 AM -
ConnectException not found
By tamayo in forum New To JavaReplies: 1Last Post: 07-23-2007, 08:23 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks