baiyygtfj
Posts: 8
Joined: Thu Apr 30, 2009 11:52 am

It always report stream-error.which reason?

Sun Jul 26, 2009 1:42 pm

When I use it in C# for wince,I used in thread, even if only to create one thread, the result is the same.
it always report two error:
1,stream error.(error code is 0x00002748).
2,"Failed to connect remote bluetooth service".(error code is 0x80131500)

I have closed the current stream in m_objectPush_DisconnectEnd event by handle.

What's trouble with it?

==============================
m_serviceBak = (RemoteService)services[0];
try
{
if (m_objectPush != null)
{
m_objectPush.Abort();
m_objectPush = null;
}
m_objectPush = new ObexObjectPush(10 * 1000);
m_objectPush.Parent = frmmain;

// setup event handlers
m_objectPush.Error += new ObexEventHandler(m_objectPush_Error);
m_objectPush.PutFileBegin += new ObexEventHandler(m_objectPush_PutFileBegin);
m_objectPush.PutFileProgress += new ObexEventHandler(m_objectPush_PutFileProgress);
m_objectPush.PutFileEnd += new ObexEventHandler(m_objectPush_PutFileEnd);
m_objectPush.DisconnectEnd += new ObexEventHandler(m_objectPush_DisconnectEnd);
}
catch
...
=================================================
try
{
m_objectPush.Abort();
if (m_streamCurrent != null)
{
m_streamCurrent.Close();
}
<font color="red"> //alway report error in here.error code is 0x00002748
m_streamCurrent = m_serviceCurrent.Stream;</font id="red">

FileStream fileStream = new FileStream(s_sendingfilename, FileMode.Open, FileAccess.Read);
m_objectPush.PushFileAsync(fileStream, Path.GetFileName(s_sendingfilename), m_streamCurrent);
}
catch (Exception exc)
{
//.....
}
====================================
private void m_objectPush_PutFileEnd(object sender, ObexEventArgs eventArgs)
{
// close file stream
ObexCopyEventArgs copyArgs = (ObexCopyEventArgs)eventArgs;

// Close Stream opened by ObexObjectPush
copyArgs.Stream.Close();
...
}
private void m_objectPush_DisconnectEnd(object sender, ObexEventArgs eventArgs)
{
// we close this stream to ensure that we get a fresh new one when pushing next time.
// this is needed since some devices do not allow multiple pushes in one stream
if (m_streamCurrent != null)
{
m_streamCurrent.Close();
}
}

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: It always report stream-error.which reason?

Fri Jul 31, 2009 6:12 pm

Usually implies that the device is turned off, the service is busy handling another connection or the device is out of range.

There is no way to know which one it is though...

Regards,
Jonas

baiyygtfj
Posts: 8
Joined: Thu Apr 30, 2009 11:52 am

RE: It always report stream-error.which reason?

Tue Aug 04, 2009 8:17 am

No,all device is turned on, and all service is idle.
I am try send file form one device to other any device, very normal.
and try use one pc software test it ,all are ok.
But use the sdk in wince,error happen rate more than 90%.

Return to “BlueTools”