Netduino home hardware projects downloads community

Jump to content

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

Kazi Murtaza

Member Since 21 Dec 2012
Offline Last Active Dec 31 2012 12:49 PM

Topics I've Started

Updating Netduino Plus

25 December 2012 - 03:09 PM

http://forums.netdui...-v420-update-1/ http://forums.netdui...-v421-update-2/ http://forums.netdui...-v410-update-6/ which one of these should I apply should I apply all or just one, if all then in which order and if one then which one :s sorry being a noob here, but Netduino is not mine, that why I want to confirm before doing anything :(

Netduino Plus Ethernet Shield

23 December 2012 - 06:33 PM

Hello, I deployed the code bellow and for some reason, I kept getting in debug window, what should I do to change the ip to  
using System;using Microsoft.SPOT;using System.Net.Sockets;using System.Net;using System.Threading;using System.Text;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware.NetduinoPlus;namespace WebserverHelloWorld{    public class WebServer : IDisposable    {        private Socket socket = null;           //open connection to onbaord led so we can blink it with every request        private OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);        public WebServer()        {            //Initialize Socket class            socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);            //Request and bind to an IP from DHCP server            socket.Bind(new IPEndPoint(IPAddress.Any, 80));            //Debug print our IP address            Debug.Print(Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress);            //Start listen for web requests            socket.Listen(10);            ListenForRequest();        }        public void ListenForRequest()        {            while (true)            {                using (Socket clientSocket = socket.Accept())                {                    //Get clients IP                    IPEndPoint clientIP = clientSocket.RemoteEndPoint as IPEndPoint;                    EndPoint clientEndPoint = clientSocket.RemoteEndPoint;                    //int byteCount = cSocket.Available;                    int bytesReceived = clientSocket.Available;                    if (bytesReceived > 0)                    {                        //Get request                        byte[] buffer = new byte[bytesReceived];                        int byteCount = clientSocket.Receive(buffer, bytesReceived, SocketFlags.None);                        string request = new string(Encoding.UTF8.GetChars(buffer));                        Debug.Print(request);                        //Compose a response                        string response = "Hello World";                        string header = "HTTP/1.0 200 OKrnContent-Type: text; charset=utf-8rnContent-Length: " + response.Length.ToString() + "rnConnection: closernrn";                        clientSocket.Send(Encoding.UTF8.GetBytes(header), header.Length, SocketFlags.None);                        clientSocket.Send(Encoding.UTF8.GetBytes(response), response.Length, SocketFlags.None);                        //Blink the onboard LED                        led.Write(true);                        Thread.Sleep(150);                        led.Write(false);                    }                }            }        }        #region IDisposable Members        ~WebServer()        {            Dispose();        }        public void Dispose()        {            if (socket != null)                socket.Close();        }        #endregion    }}
using System;using System.Net;using System.Net.Sockets;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.NetduinoPlus;namespace WebserverHelloWorld{    public class Program    {        public static void Main()        {                        Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableDhcp();            WebServer webServer = new WebServer();            webServer.ListenForRequest();        }    }}

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.