Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WebSocket
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 10-Jan-13 5:42am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Comments
blackbolek at 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 at 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)

  Print Answers RSS
0 George Jonsson 175
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100