how to pass socket between threads in the same process

  • Follow


Hi
I use one thread as listening thread, accept tcp connection and try to pass
the connect socket to another thread by ipc msg. It doesn't work. Any help
would be appreciated.



0
Reply glen 6/15/2004 9:16:44 PM

In article <canp43$ig$1@newshost.mot.com>,
 "glen" <cgz002@email.mot.com> wrote:

> Hi
> I use one thread as listening thread, accept tcp connection and try to pass
> the connect socket to another thread by ipc msg. It doesn't work. Any help
> would be appreciated.

You shouldn't need to do this.  Since the other threads is in the same 
process, it can just access the socket directly.  All threads in a 
process share the same address space and descriptors.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
0
Reply Barry 6/16/2004 4:08:58 AM


fds are shared between threads in Solaris... so all you need is the
right integer value.  Using ipc (which you're clearly doing erronously)
between threads is overkill....

- Bart


"glen" <cgz002@email.mot.com> wrote in message news:<canp43$ig$1@newshost.mot.com>...
> Hi
> I use one thread as listening thread, accept tcp connection and try to pass
> the connect socket to another thread by ipc msg. It doesn't work. Any help
> would be appreciated.
0
Reply barts 6/16/2004 4:56:43 AM

2 Replies
613 Views

(page loaded in 0.051 seconds)

Similiar Articles:













7/25/2012 12:15:43 AM


Reply: