Click here to Skip to main content
15,890,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I'm trying to find a communication method between web application and desktop application on Windows PC. At the moment I have a group of applications written in C++ (MFC) for Windows desktop environment. They can communicate between each other using TCP sockets - locally or over LAN.

I'm thinking about creating simple web application (I want it to run on smartphones), which will be able to connect to the PC via internet and exchange information with it.

I don't have experience in web technologies at the moment, so possibly I'm looking in wrong direction completely, but here is my idea of it:

1. I need to write web application (HTML / Java) which will run in browser on any smartphone with internet connection. (like web page saved on local disk)

2. I need to write a 'server' application for Windows which will pass required data to the web app

3. I need to find a way of continuous communication between the 2.

After doing some research I think WebSockets are good solutions for it. I found few demo projects, and I played with them, but every time, I have the same problem: I can connect from browser to server locally or in LAN, but it doesn't connect when I try to use my external IP address. So then I read that routers (or ISPs) are blocking most ports, which probably is a reason of the problem. However forwarding ports and configuring routers is not practical for my solution - I would have to do it for every client.
So then I found that using Secure Websocket (wss) should help with dealing with routers and so on. I tried that, but still no joy.

So my question is: is the websocket right way of communication in this situation or should I look somewhere else?

Thanks in advance
Posted

1 solution

It really depends critically on what server-side technology you can use. In many cases, it still can be TCP, but firewalls the problem. For example, with ASP.NET you can use the power of WCF. It's just impossible to make a decisive recommendation based on limiting knowledge of your situation.

—SA
 
Share this answer
 
Comments
blackbolek 11-Jan-13 2:48am    
I see.
Just to clarify a bit: I'm not planning to use single server, but I want to install 'server' app on each of my customers PC. So for example: Customer A receives a data on his smartphone from server app installed on his office PC. This will be replicated for every customer.
Can it be achieved? I can probably allow firewall configuration on customer PC.
Sergey Alexandrovich Kryukov 11-Jan-13 2:57am    
Well, in some cases, this is quite a good idea. Very often, typical "central server" model is used only because of bad inertia of thinking, nothing else. And, technologically, it does not make big difference. Sure, quite possible.

As to WebSockets, it also allows to get over firewalls because of use of HTTP. Personally, I'm sure that the state of affairs about this firewall stuff is purely idiotic. Firewalls were created for safety, but allowed HTTP which was considered "innocent". And, over HTTP, people started to bridge protocol and services, functionally no safer then what could be done based on TCP, only with additional considerable overhead... Can you see it? But this is the real life now; we cannot do much about it...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900