|
-
Jan 10th, 2013, 11:11 AM
#1
Communication Between a WebServer and WinForm Application (Dynamic IP)
I have a requirement where I need to pass data between a webserver and a windows service/desktop app.
The idea is like this:
Method #1
1. User opens the web page (hosted on remote web server) and clicks "See what iPrank is doing now" button.
2. The web server connects to a webservice running on MY computer. (hosted inside a Winform application, using Cassinni++).
3. My webservice then sends my data back to web server.
4. Web server displays the data to the user's browser.
Both the web server and my own internal server have webservices. They can talk with one another without any problem.
But, the problem is, I have dynamic IP. So, through a separate webservice I'm supplying my IP to the webserver every few seconds.
For example currently, URL to my internal (hosted inside Winform app) webserver is http://1.2.3.4:8080 (1.2.3.4 is my external IP)
This works for my own computer/network. Other people can connect to my internal web server from any network/internet.
But, in some other computer network this doesn't work. Even if I disable firewall, I'm unable to ping to those computers using their external ip.
A quick search returned me results, most of them are talking about changing default gateway or configuring router.
This software will be used by small office users. Most of them do not know about configuring network.
So, here is my second (bad) idea.
Method #2
1. User opens the web page (hosted on remote web server) and clicks "See what iPrank is doing now" button. (Let us call it COMMAND)
2. The web server then saves the 'COMMAND' in a database table and waits. (Thread.Sleep() or Timer).
3. My desktop app (no internal webserver/webservice in this case) periodically checks the remote database server for any new pending COMMAND every second.
4. When the desktop app finds there is a new COMMAND, it executes that COMMAND and saves the result in the remote database.
5. When the web server finds that a new result has been posted for that COMMAND. It gets the data and renders the page.
As you can see, using method#2 I don't need to host any web service on client's computer. Just a little desktop app running on system tray/service is enough.
But, this method is slower and not 'proffessional'.
Can anyone suggest me any better idea ? (Not using WCF)
If it is not possible with Winforms, can anyone suggest me a 'smoother' data transfer for method#2 ?
Last edited by iPrank; Jan 10th, 2013 at 11:15 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|