Solved

http server question

Posted on 2014-04-16
10
248 Views
Last Modified: 2014-04-28
Hi Experts,
I know this is almost 100% not possible, but just in case.  Is it possible to listen on a port on a machine (on localhost), where if the server is running in a given session, it won't be visible to other sessions?

Or, is there a way to communicate from a web browser other than using plugins and other than using http requests to something on localhost?

Just brainstorming.

Thanks,
Mike
0
Comment
Question by:thready
  • 5
  • 3
  • 2
10 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
ID: 40004752
That doesn't make a whole lot of sense.  The whole purpose of web browsers is to communicate using HTTP.  They can also use FTP.

The software that most frequently does something like you're talking about is your anti-virus software.  AV software usually sets up a 'proxy' that all traffic is routed thru so that it can be checked for viruses and malware.  This is way beyond 'web programming'.
0
 
LVL 86

Expert Comment

by:jkr
ID: 40004849
What bowser are you thinking of? Would "rolling your own" be an option?
0
 
LVL 1

Author Comment

by:thready
ID: 40004882
Hi Dave, this is in fact way beyond web programming...  :)   Working on a very complicated piece of enterprise software that communicates to many different types of servers...

jkr - nope - we need to stick to chrome, firefox and IE...

I knew my question was a shot in the dark, just hoping for some open minded innovation!  Not always possible though- especially with the tightening of the browser security models.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40004976
I don't believe there is any reliable native way to "talk to the browsers" other than HTTP.  While I'm certain that it is possible to hook into the browsers, it's just as likely to get 'unhooked' with the next update.  Chrome and Firefox update fairly frequently.
0
 
LVL 1

Author Comment

by:thready
ID: 40004991
Sounds like you've been having "fun" with this kind of thing as well...  And just in case - I'm not interested in talking "to" the browser - the browser remains a client in what I'm looking for.  For instance, we've used JSONP, http and https so far...  even a plugin where the former wasn't possible...  I'm always open to anything else people might have up their sleeve....

Thanks,
Mike
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 86

Expert Comment

by:jkr
ID: 40005005
>>nope - we need to stick to chrome, firefox and IE...

What a pity - we did something similar recently by creating our own WebKit-based browser, adding a custom communications layer and connecting that back to the browser via a Qt bridge...
0
 
LVL 1

Author Comment

by:thready
ID: 40005055
That sounds very interesting!  I'm not sure I get it though...

I just looked up Qt bridge - looks like you've got direct access to your thick application code through javascript because the underlying object model is QObject like in the declarative framework?
0
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 40005087
Yup, that's it. We mainly need a JS interaction with the server without a HTTP connection and just created a simple driver class like

class CommDriver : public QObject {

    Q_OBJECT

    CommDriver(QWebFrame*);
    virtual ~CommDriver();

    int  CommRequest(const QString& s, CommThread* p);
    void CommResult(const QString& sId, const QString& sRes);
    bool HasConnector() const { return m_hDll && m_pReq;}


public slots:
    Q_INVOKABLE
    bool createRequest(const QString& sReqId, const QString& sReq);

signals:

    void returnRequest(const QString& sReqId, const QString& sResponse);

    const QString& GetRequest() const { return m_sRequest;}
    void SetRequest(const QString& s) { m_sRequest = s;}

    const QString& GetResponse() const { return m_sResponse;}
    void SetResponse(const QString& s) { m_sResponse = s;}

protected:

    QString m_sRequest;
    QString m_sResponse;

protected:

    QWebFrame* m_frame;

    HINSTANCE m_hDll;
    FPTR_CommClientRequest m_pReq;

    unsigned m_unThreadCount;
    QThreadPool m_pool;

private slots:
    void addJSObject();
};

Open in new window


that was then added via

            // Signal is emitted before frame loads any web content:
            QObject::connect(m_frame, SIGNAL(javaScriptWindowObjectCleared()),
                             this, SLOT(addJSObject()));

Open in new window


That way, the loaded JS code could "talk" to the server via an arbitrary connection implemented in the driver. Just out of fun, we even created a small server in a DLL that the driver loaded (you can see the handle declared in the snippet).
0
 
LVL 1

Author Comment

by:thready
ID: 40005103
Very cool.  I've been getting hooked on Qt mobile.  Particularly QML...  Thanks for sharing!
0
 
LVL 1

Author Closing Comment

by:thready
ID: 40028138
Thanks guys, this answers my question - it's not possible!  :)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
A procedure for exporting installed hotfix details of remote computers using powershell
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now