Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This query is related to application design the technology that I should consider during migration. The Scenario: I have a C#.net Winform application which communicates with a device. One of the main feature of this application is monitoring cyclic data(rate 200ms) sent from the device to the application. The request to start the cyclic data is sent only once in the beginning and then the application starts receiving data from the device until it sends a stop request. Now this same application needs to be deployed over the web in a intranet. The application is composed of a business logic layer and a communication layer which communicates with the device through UDP ports.

I am trying to look at a solution which will allow me to have a single instance of the application on the server so that the device thinks that it is connected as usual and then from the business logic layer I can manage the clients. I want to reuse the code of the business layer and the communication layer as much as possible. Please let me know if webserives/WCF/ etc what i should consider to design the migration.

Thanks in advance.

share|improve this question

migrated from stackoverflow.com Jan 16 '12 at 15:06

This question came from our site for professional and enthusiast programmers.

1  
I think that you can't do in a simple way unless you still have a connector/plugin installed in each machine where the device is connected. Like when I come back from running and I Upload data from Garmin GPS watch into Garmin Connect site, there is a plugin for the browser to install once and this runs on my real machine, connects via UDP/TCP/I don't know then sends the data to the server. –  Davide Piras Jan 16 '12 at 10:32
    
nice pointer Davide..so if i develop a plugin for web browsers and through that plugin i create a UDP connection between the client and the server then I can get the data from the server application. The device will only be connected to the single server. The clients will connect to the server via web browser plugin. Please let me know if it is feasible to create a UDP connection in the plugin to connect the server? –  user1151597 Jan 16 '12 at 10:48
    
no wait a sec. the device is connected to the client via USB cable or serial cable? or where and how is connected? How many users do you have and how many devices? –  Davide Piras Jan 16 '12 at 10:50
    
no, the device will always be connected to the server via Ethernet. The clients will connect to the server, the server will connect to the device locally and the server will manage the requests from the client to the device and the response of the device to the clients. –  user1151597 Jan 16 '12 at 11:04
    
ok then you do not need any browser plugin. Just start with ASP.NET and WCF –  Davide Piras Jan 16 '12 at 11:15

2 Answers 2

Personally I would be tempted to modify the existing program and add a web request handling layer to it. The application would then run on the server and maintain a constant connection to the device. A website could then be constructed which communicates with this application via AJAX/Json calls every 200ms to retrieve the latest data from the application.

While creating a web service may work, it would run as a separate instance per user request, depending on how many users are trying to connect to the device, this may overload the device with multiple connections.

I faced a similar dilemma recently with an application I developed, except my decision was further enhanced by the fact I needed to receive data even when no users were connected. Also I had previously written a Web server DLL that I could plug straight in.

share|improve this answer

WCF does not come with a UDP binding out of the box. You can write a custom UDP binding using this sample as a guide but I'd be wary of doing so. The code in the sample is closer to demo code than proven production quality code. Given that, you may want to go with a Windows service that handles the UDP interaction leveraging your existing code to populate an appropriate data store. Then the WCF service could be written as a conventional database interaction service.

share|improve this answer
    
yeah, even i am thinking on the same lines.. i'll create a windows service and host WCF service here. The windows service will create and manage UDP connection with the device. –  user1151597 Jan 16 '12 at 18:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.