Using the same socket in different/multiple threads, possible? how?
| Fri, 2006-01-13 11:17 | |
|
My program creates two threads: one thread sends data, another thread receives data.
Is it possible to:
The reason I want to use the same socket for both sending and receiving is that I want the sending and receiving socket to use the same source port. I did find out the RSocketServ can be used in multiple threads (using the ShareAuto() method), but what use is sharing the RSocketServ when you can't share the sockets themselves? |
|






Forum posts: 723
In addition, you're really discouraged to use threads in such a scenario: you should rather get familiar with active objects, a "replacement" of threads, instead. Okay, threads still can be used, but active objects is really the preferred solution in Symbian OS.
Tote
Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/
Forum posts: 19
Symbian OS resources such as RFiles and RSockets are derived from class RSubSessionBase, so are thread specific. This means they cannot be used by any thread other than the one which opened them.
In an application where RSockets are created and used in different threads, we do see that our application works fine on the emulator .. Is it that the RSocket objects are not shared only on the device ?
Are there any workarounds in the case that we are forced to use them in different threads?
Thanks,
Tanuja
Forum posts: 723
Tote
Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/