Solved

http server question

Posted on 2014-04-16
10
252 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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
 
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Scenario:  You do full backups to a internal hard drive in either product (SBS or Server 2008).  All goes well for a very long time.  One day, backups begin to fail with a message that the disk is full.  Your disk contains many, many more backups th…
A procedure for exporting installed hotfix details of remote computers using powershell
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

813 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

18 Experts available now in Live!

Get 1:1 Help Now