Ethernet Broken?
#1
Posted 18 September 2012 - 01:47 PM
#2
Posted 18 September 2012 - 02:18 PM
Attached Files
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#3
Posted 18 September 2012 - 02:19 PM
#4
Posted 18 September 2012 - 10:35 PM
#5
Posted 19 September 2012 - 06:33 AM
Could you try to execute this?
For references you could use the same project file.
I'm curious if it'll brake somewhere. This is the most basic web request I could make...
using System; using System.Threading; using System.Net; using System.Net.Sockets; using System.Text; using Microsoft.SPOT; using Microsoft.SPOT.Net; namespace NetworkOutput { public class Program { public static void Main() { // Queries the DNS IPHostEntry ip = Dns.GetHostEntry("www.google.com"); for (int IpIndex = 0; IpIndex < ip.AddressList.Length; ++IpIndex) Debug.Print("www.google.com resolves to " + ip.AddressList[IpIndex].ToString()); // Connects to Google Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); sock.Connect(new IPEndPoint(ip.AddressList[0], 80)); // Builds the request string request = "HEAD / HTTP/1.1\r\n"; request += "Host: www.google.com\r\n"; request += "Connection: Close\r\n"; request += "\r\n"; sock.Send(Encoding.UTF8.GetBytes(request)); // Gives google 1 second to reply for now :-) Thread.Sleep(1000); // Reads out the full buffer byte[] RecBuffer = new byte[sock.Available]; sock.Receive(RecBuffer); Debug.Print(new String(Encoding.UTF8.GetChars(RecBuffer))); // Nicely closes the connection sock.Close(); } } }
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#6
Posted 20 September 2012 - 12:53 AM
#7
Posted 20 September 2012 - 08:42 AM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#8
Posted 20 September 2012 - 08:28 PM
StreamWriter stOut = new StreamWriter(req.GetRequestStream());The N+ just sits there with the onboard led solid and the Ethernet activity light flashing.
Any idea?
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; using Microsoft.SPOT.Net.NetworkInformation; using System.Text; using System.IO; using System.Net; namespace BC { public class Program { public static void Main() { OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); int numTests = 720; while (numTests > 0) { //write test data and show LED led.Write(true); Thread.Sleep(250); try { string strNewValue; string strResponse; HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://SERVERNAME/PATH/InsertFile.php"); req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; req.KeepAlive = false; // Set values for the request back strNewValue = "TestID=''&TestDesc=TestData"; req.ContentLength = strNewValue.Length; // Write the request StreamWriter stOut = new StreamWriter(req.GetRequestStream()); stOut.Write(strNewValue); stOut.Close(); // Do the request to get the response StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream()); strResponse = stIn.ReadToEnd(); stIn.Close(); } catch (Exception ex) { Debug.Print(ex.Message.ToString()); } //hide LED led.Write(false); Thread.Sleep(250); numTests--; } } } }
#9
Posted 21 September 2012 - 04:16 PM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#10
Posted 21 September 2012 - 04:23 PM
#11
Posted 21 September 2012 - 09:27 PM
#12
Posted 21 September 2012 - 09:36 PM
No problemIt works perfectly well with your web server, so it must be my server side code or my host. Thanks for taking the time to work on it with me Stefan.
Glad I could help out a bit. I hope you'll find a proper solution too.
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#13
Posted 21 September 2012 - 09:39 PM
#14
Posted 21 September 2012 - 09:50 PM
Web service, yes. Not really .net specific. It's the HTTP protocol, not the language behind that. It could be .NET, PHP, JSP, etc.You wouldn't know how to call a .Net web service would you?
I know of an issue with IIS though, not accepting connections from netduinos. See http://forums.iis.net/t/1166229.aspx for more info about that error.
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users