func PrepareSockets(connInfo ConnectionInfo) (SocketGroup, error) {

	// Initialize the Socket Group.
	context, sg, err := createSockets()
	if err != nil {
		return sg, errors.Wrap(err, "Could not initialize context and Socket Group")
	}

	// Bind the sockets.
	address := fmt.Sprintf("%v://%v:%%v", connInfo.Transport, connInfo.IP)
	sg.ShellSocket.Bind(fmt.Sprintf(address, connInfo.ShellPort))
	sg.ControlSocket.Bind(fmt.Sprintf(address, connInfo.ControlPort))
	sg.StdinSocket.Bind(fmt.Sprintf(address, connInfo.StdinPort))
	sg.IOPubSocket.Bind(fmt.Sprintf(address, connInfo.IOPubPort))

	// Message signing key
	sg.Key = []byte(connInfo.Key)

	// Start the heartbeat device
	HBSocket, err := context.NewSocket(zmq.REP)
	if err != nil {
		return sg, errors.Wrap(err, "Could not get the Heartbeat device socket")
	}
	HBSocket.Bind(fmt.Sprintf(address, connInfo.HBPort))
	go zmq.Device(zmq.FORWARDER, HBSocket, HBSocket)

	return sg, nil
}
// PrepareSockets sets up the ZMQ sockets through which the kernel will communicate.
PrepareSockets sets up the ZMQ sockets through which the kernel will communicate.
// PrepareSockets sets up the ZMQ sockets through which the kernel will communicate .
func PrepareSockets(connInfo ConnectionInfo) (SocketGroup, error) {
	context, sg, err := createSockets()
	if err != nil {
		return sg, errors.Wrap(err, "Could not initialize context and Socket Group")
	}
	address := fmt.Sprintf("%v://%v:%%v", connInfo.Transport, connInfo.IP)
	sg.ShellSocket.Bind(fmt.Sprintf(address, connInfo.ShellPort))
	sg.ControlSocket.Bind(fmt.Sprintf(address, connInfo.ControlPort))
	sg.StdinSocket.Bind(fmt.Sprintf(address, connInfo.StdinPort))
	sg.IOPubSocket.Bind(fmt.Sprintf(address, connInfo.IOPubPort))
	sg.Key = []byte(connInfo.Key)
	HBSocket, err := context.NewSocket(zmq.REP)
	if err != nil {
		return sg, errors.Wrap(err, "Could not get the Heartbeat device socket")
	}
	HBSocket.Bind(fmt.Sprintf(address, connInfo.HBPort))
	go zmq.Device(zmq.FORWARDER, HBSocket, HBSocket)
	return sg, nil
}
func PrepareSockets ( connInfo ConnectionInfo ) ( SocketGroup , error ) { context , sg , err := createSockets ( ) if err != nil { return sg , errors . Wrap ( err , " " ) } address := fmt . Sprintf ( " " , connInfo . Transport , connInfo . IP ) sg . ShellSocket . Bind ( fmt . Sprintf ( address , connInfo . ShellPort ) ) sg . ControlSocket . Bind ( fmt . Sprintf ( address , connInfo . ControlPort ) ) sg . StdinSocket . Bind ( fmt . Sprintf ( address , connInfo . StdinPort ) ) sg . IOPubSocket . Bind ( fmt . Sprintf ( address , connInfo . IOPubPort ) ) sg . Key = [ ] byte ( connInfo . Key ) HBSocket , err := context . NewSocket ( zmq . REP ) if err != nil { return sg , errors . Wrap ( err , " " ) } HBSocket . Bind ( fmt . Sprintf ( address , connInfo . HBPort ) ) go zmq . Device ( zmq . FORWARDER , HBSocket , HBSocket ) return sg , nil }
PrepareSockets sets up the ZMQ sockets through which the kernel will communicate.
PrepareSockets sets up the ZMQ sockets through which the kernel will communicate .
// Initialize the Socket Group. // Bind the sockets. // Message signing key // Start the heartbeat device