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.

Michael Walker

Member Since 20 Jun 2011
Offline Last Active Jul 15 2014 08:40 AM

Posts I've Made

In Topic: Windows Form + Netduino+ trouble

29 July 2011 - 05:00 AM


You are firstly overwriting your variable socket with the client socket after Accept is triggered, secondly you are putting the socket in the using scope which will call dispose on the closing }.

As mentioned above create a new variable from the socket.Accept(), should look something like:

while (true)
                string message;

                using (var clientSocket = socket.Accept())

                    //Get request
                    var bufferRequest = new byte[256];
                    int bytes;

                        bytes = clientSocket.Receive(bufferRequest, bufferRequest.Length, 0);

                    } while (bytes > 0);

                    message = new String(Encoding.UTF8.GetChars(bufferRequest));

                //ToDo: your LED logic here...

Hope this helps :D


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.