yes, I know I can't send  OpenSSL SSL_CTX object.

so I want to use the stream.pipe to send a socket object. becase the only
socket and

but I don't konw how to implemate 。


On Tue, May 21, 2013 at 7:40 PM, Ben Noordhuis <[email protected]> wrote:

> On Tue, May 21, 2013 at 1:07 PM, chenxu zhao <[email protected]> wrote:
> >  i have the same problem like this post
> >
> >
> http://stackoverflow.com/questions/12971738/pass-tls-cleartextstream-instance-to-worker-process
> >
> > I want to use a stream.pipe to send.
> >
> > but how, like this ?
> >
> > var  tls_socket = new net.sockert()
> > cleartextStream.pipe(tls_socket);
> >
> > but tls_socket can't send to child_process too .
> >
> > child_process.js:134
> >       handle.onread = function() {};
> >                     ^
> > TypeError: Cannot set property 'onread' of null
> >     at ChildProcess.handleConversion.net.Socket.send
> > (child_process.js:134:21)
> >     at ChildProcess.target.send (child_process.js:436:52)
> >     at Server.<anonymous>
> > (/Users/zcx/BestApp/android-mqtt-push-server/server_master_zmq.js:171:12)
> >     at Server.EventEmitter.emit (events.js:98:17)
> >     at SecurePair.<anonymous> (tls.js:1117:16)
> >     at SecurePair.g (events.js:175:14)
> >     at SecurePair.EventEmitter.emit (events.js:92:17)
> >     at SecurePair.maybeInitFinished (tls.js:896:10)
> >     at CleartextStream.read [as _read] (tls.js:430:15)
> >     at CleartextStream.Readable.read (_stream_readable.js:294:10)
>
> You cannot send over tls objects.  They're tied to OpenSSL SSL_CTX
> objects and those are not transferable to other processes.
>
> You can however send net.Socket objects and do something like below in
> your workers:
>
>   var server = tls.createServer(...);
>   process.on('message', function(msg, handle) {
>     assert(handle instanceof net.Socket);
>     server.emit('connection', handle);
>   });
>
> As long as you send over the net.Socket objects before the SSL/TLS
> handshake has begun, this should work fine.
>
> --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to