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

TCP Basic Script


  • Please log in to reply
6 replies to this topic

#1 JoRu1407

JoRu1407

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 02 February 2013 - 04:23 PM

Hello guys, i've just one short question:

 

Is there any C# basic script for setting and reading ports with an http request?


For example I would like to call "http://192.168.1.231/set/1/true" to set port 1 on or "http://192.168.1.231/get/1" to read the state of a port.

 

Many thanks in advance,

JoRu1407



#2 MarkNic

MarkNic

    Member

  • Members
  • PipPip
  • 22 posts

Posted 02 February 2013 - 10:13 PM

Your best bet is to go with a Web Server component. There are many out there. I played with a couple for a while and then created my own. For what you described, This one would probably do: http://www.schuurman...r-netduino-plus

 

Mark



#3 JoRu1407

JoRu1407

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 02 February 2013 - 11:15 PM

Hello Mark,

 

thank you very much for your quick reply.

I'll try the server tomorrow. ;-)

 

JoRu1407



#4 JoRu1407

JoRu1407

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 05 February 2013 - 07:48 PM

Hi Mark,

 

the linked server runs fine, but it doesen't respond.

If I assume the original code and call "http://IP/setled/on" Firefox reports "The connection to the server was reset while the page was loading."

 

Does anyone know what's that for a bug?



#5 JoRu1407

JoRu1407

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 08 February 2013 - 04:30 PM

Does no one else have this problem?



#6 MarkNic

MarkNic

    Member

  • Members
  • PipPip
  • 22 posts

Posted 11 February 2013 - 03:16 PM

JoRu1407,
 

The error you're getting is that the http connection is dropping before the response comes back.  I'm just guessing but I expect the response from the Netduino is taking a long time.  Hard to say why with the info here.

I just loaded up the web server code from the site and tested it. The setled command worked as expected
on my machine:


    [*]http://10.0.0.39/setled/on and it responded immediately
    [*]Windows 8/VS 2012 (was using 2010 but loaded MF 4.3 last night so I used 2012 to test here)
    [*]Netduino Plus 2 - created a new NP2 solution/project and copied the code over to quickly make sure I had the right assemblies since the project on the web site was NP1
    [*]IE10/Chrome - both worked and responded with "[color=rgb(0,0,0);]You called SetLed with argument: on[/color]" and the board led lit up
    [*]I don't use firefox so no test there
    [/list]

    Mark



#7 JoRu1407

JoRu1407

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 31 March 2013 - 09:04 PM

Hi Marc, sorry for my late answer, but I couldn't fix the problem yet.

 

The point is: I don't know where I'm doing something wrong. I only copy the code from the example and run it on the Netduino.

Do you have any other idea?






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.