dtnghia
Posts: 24
Joined: Thu Sep 18, 2008 8:54 pm
Location: Vietnam

How to end open stream

Mon Nov 24, 2008 8:41 am

Hi,

In my OBEX PUSH Client application, i have code as:

//CODE1
currentStream = ((RemoteService)services[0]).Stream //(*)
//CODE2

Once (*) be executed, the alert will appears on mobile phone, i did not do any action (Yes,No) on mobile and exit application, but the application could not exit at all, it seem the thread of (*) still process. I must go to task manager to end it.

I put the break point on (*), and see that CODE2 will not executed until mobile return "Yes" or "No"

So my question is : if i can end stream of (*) with the other thread?
Or you may have the other advice to handle it?

Thanks

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

RE: How to end open stream

Mon Nov 24, 2008 10:18 am

You can close the Stream. That will close the connection.

Regards,
Jonas

dtnghia
Posts: 24
Joined: Thu Sep 18, 2008 8:54 pm
Location: Vietnam

RE: How to end open stream

Mon Nov 24, 2008 12:04 pm

Hi Jonas,

As i comment, the CODE2 will not be reached if mobile did not do any action (Yes or No). So i could not close the stream.

Thanks

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

RE: How to end open stream

Mon Nov 24, 2008 1:54 pm

No, you have to do it in a separate thread as you yourself said.
While you are waiting for the phone to respond your application will be de facto deadlocked if it's single-threaded.

Regards,
Jonas

Return to “BlueTools”