Solved

http server question

Posted on 2014-04-16
10
242 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 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
Comment Utility
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
Comment Utility
What bowser are you thinking of? Would "rolling your own" be an option?
0
 
LVL 1

Author Comment

by:thready
Comment Utility
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 82

Expert Comment

by:Dave Baldwin
Comment Utility
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
Comment Utility
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
Do email signature updates give you a headache?

Constantly trying to correctly format email signatures? Spending all of your time at every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

 
LVL 86

Expert Comment

by:jkr
Comment Utility
>>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
Comment Utility
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
Comment Utility
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
Comment Utility
Very cool.  I've been getting hooked on Qt mobile.  Particularly QML...  Thanks for sharing!
0
 
LVL 1

Author Closing Comment

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

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

771 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

13 Experts available now in Live!

Get 1:1 Help Now