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

N+2 ethernet communication with Windows Form


  • Please log in to reply
11 replies to this topic

#1 Faith

Faith

    Member

  • Members
  • PipPip
  • 13 posts

Posted 04 February 2014 - 09:57 AM

Hi to everyone,

 

I'm not new to Netduino, but this is my first time with ethernet communication.

 

I'm trying to understand how to set a communication between my PC and Netduino Plus 2 through ethernet. As a start, I found here and in internet a lot of projects which use a class (usually called WebServer) to communicate with a browser, but using these solutions I've never been able to set any communication.

 

For these reasons I have two questions for you:

1) can you please link me a solution which you use successfully with your N+2 so I can check if everything is ok with my PC - N+2 connection?

2) (After point 1) do you have any code example which can help me in the creation of a Windows Form (with Visual Studio 2010) which can be connected to N+2 through ethernet? Obviously I talk about only the communication part of the code.

 

Thank you very much.



#2 twinnaz

twinnaz

    Advanced Member

  • Members
  • PipPipPip
  • 38 posts
  • LocationBrampton, Ontario

Posted 04 February 2014 - 01:21 PM

You can check my code out its not entirely working but you can send a message or value over using sockets. I still have to get it to continuously loop sending messages back and fourth. http://forums.netdui...h-windows-form/


Netduino Plus 2


#3 Faith

Faith

    Member

  • Members
  • PipPip
  • 13 posts

Posted 07 February 2014 - 02:56 PM

Running these first lines of code I always have as output "0.0.0.0". What does it mean?

//Initialize Socket classsocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);//Request and bind to an IP from DHCP serversocket.Bind(new IPEndPoint(IPAddress.Any, 80));//Debug print our IP addressDebug.Print(Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress);


#4 wendo

wendo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 07 February 2014 - 09:16 PM

Your netduino doesn't have an IP address. Typically your router would give new devices an IP address using DHCP when they connect to your network. How exactly are you connecting your netduino to the network?

 

Are you connecting it to a router that your PC is also connected too, or are you trying to run a cable directly between the netduino and your PC?



#5 lifanek

lifanek

    Member

  • Members
  • PipPip
  • 23 posts
  • LocationKatowice, Poland

Posted 08 February 2014 - 12:08 AM

Try MFDeploy tool and check DHCP or set some IP over there.



#6 Faith

Faith

    Member

  • Members
  • PipPip
  • 13 posts

Posted 08 February 2014 - 09:25 AM

Thank you for your replies!

 

In MFDeploy DHCP is checked.

 

If I connect N+2 to my router I can communicate easily through ethernet (thank you wendo), before I was trying a direct communication N+2-PC. What I have to do in this case?



#7 wendo

wendo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 08 February 2014 - 05:56 PM

If you have to connect directly between a PC and the netduino, then you will either need to set a static IP address on the netduino and on the PC that's not the same as your normal network (if the PC will be connected to both at the same time). Or run a DHCP server on your PC.

 

Assuming the PC has 2 network cards then you're probably better off setting static IP addresses on each device.



#8 Faith

Faith

    Member

  • Members
  • PipPip
  • 13 posts

Posted 08 February 2014 - 06:32 PM

If I try to set a static IP address, I get an error when I ask to save the configuration ("Unable to write the configuration", OUTOFMEMORY). I've read that an old firmware had this problem but I have 4.2.2.2 version. Do I need to install 4.3.0 beta firmware?



#9 wendo

wendo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 09 February 2014 - 06:15 AM

I can't see why you would, what version SDK do you have installed? Is that also the 4.2 version, or did you install the 4.3 SDK?

 

MFDeploy from 4.3 has some issues when used against a 4,2 firmware



#10 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 09 February 2014 - 07:22 AM

Faith--when you set the network configuration from MFDeploy, are you using a Netduino Plus gen1 board? If so, be sure to boot it in TinyBooter mode to change settings. And then unplug/re-attach afterwards to reboot it. Chris

#11 Faith

Faith

    Member

  • Members
  • PipPip
  • 13 posts

Posted 09 February 2014 - 12:09 PM

I have a Netduino Plus 2 board with SDK version 4.2.2.2 (the one which I found in the page netduino.com/downloads/). I asked about the firmware because I read about problems in setting static IP address with older versions, but I suppose that with my configuration everything should be ok. What can I do? For the moment I'm using the board connected to the router with DHCP enabled.

#12 Fradique Lee

Fradique Lee

    New Member

  • Members
  • Pip
  • 1 posts

Posted 20 May 2014 - 04:54 PM

If you want to connect an ethernet cable directly to your pc you have to set a DHCP on your pc as said above.

This could be done easily in windows, without setting a fixed ip on the device, just connect your pc via your wireless card or another card and then share it.  When you share the said network you'll be asked to choose the card to be the server, this will get an static ip and abilitate a DHCP server, so when the Netduino is connected it will get an address from it.






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.