Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Anyone using WCF?

wcf

  • Please log in to reply
3 replies to this topic

#1 iced98lx

iced98lx

    Advanced Member

  • Members
  • PipPipPip
  • 134 posts
  • LocationSouth Dakota

Posted 25 June 2013 - 03:33 PM

I know a ton of folks are running a webserver on the N+2 for status/control but is anyone using WCF? I'm leaning towards not wanting a full webserver on the device due to performance reasons, trying to figure out ways get status and have control in real time without the overhead of the full web server.



#2 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 25 June 2013 - 10:06 PM

If you only want to send simple messages back and forth, you could always use sockets but perhaps that's a bit too simple plus you'd have to do any and all marshalling by yourself if you plan to transfer more complex structures. A web server doesn't have to be all that "full" either, you could just parse out the query string from the headers, perform the corresponding operation(s) and return a string like "OK" or whatever. I don't know if the HttpListener class et al is available but if so, it would make it very easy to implement a light weight web server. You could do many of the requests using AJAX and thus do the request/response parsing in client side javascript while displaying a fancy main page with the buttons and controls and what have you. Maybe throw in some JSON to get a little more structure in the server (device) responses. Now, I don't really know WCF or its benefits and maybe you have already considered the above.

#3 iced98lx

iced98lx

    Advanced Member

  • Members
  • PipPipPip
  • 134 posts
  • LocationSouth Dakota

Posted 26 June 2013 - 01:12 AM

If you only want to send simple messages back and forth, you could always use sockets but perhaps that's a bit too simple plus you'd have to do any and all marshalling by yourself if you plan to transfer more complex structures. A web server doesn't have to be all that "full" either, you could just parse out the query string from the headers, perform the corresponding operation(s) and return a string like "OK" or whatever. I don't know if the HttpListener class et al is available but if so, it would make it very easy to implement a light weight web server. You could do many of the requests using AJAX and thus do the request/response parsing in client side javascript while displaying a fancy main page with the buttons and controls and what have you. Maybe throw in some JSON to get a little more structure in the server (device) responses. Now, I don't really know WCF or its benefits and maybe you have already considered the above.

 

I had sort of considered the above, and sort of ruled it out because I couldn't find a clean example of a very simple webserver. While looking at just using UDP and passing the data that way I stumbled across WCF and thought "Gee whiz, a built in high level way of transferring data, seems sweet!" Then I found  a very simple to understand and use webserver example that wasn't big and messy and I just opted to go with it instead.  I am just going to be passing XML back and forth between the N+2 and an intermediate webserver which will handle all the pretty bits, or to an application on my PC for monitoring/control which will handle the pretty bits, or to an app on my phone which will.... 

 

I think you get the point. The web server I ended up with is simple, and lets me integrate it into my already existing functions, so that's nice and I was able to easily understand what it was doing when I looked at it, which is important to me. it also doesn't appear to suck up memory, so that's also nice.



#4 Frankie

Frankie

    Member

  • Members
  • PipPip
  • 16 posts
  • LocationArnhem, Netherlands

Posted 20 October 2013 - 10:54 AM

just use a basic socket implementation and return some json strings

 

if the request is good i parse it and throw it in an handler class that executes the operation and its response will go back on the socket as json.

works great with AJAX requests







Also tagged with one or more of these keywords: wcf

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.