Introducing mIP - A 100% Managed TCP/IP Stack for .NET MF

Edit: I got it working, for now…
I’ll create a new post for the question.
Thanks

@ Jay Jay: first of all: are you using the Managed TCP/IP stack described in this topic?

No sir,
Using the standard netmf…
Board spider…
Maybe I should create a new post…

@ Jay Jay: if you want to have a better response, I suggest you copy the content and start a new topic in the correct board. You can then remove your question from this thread. :slight_smile:

I tried mIP on my Cerberus with ENC28J60 bought on eBay. And I very impressed about what I have seen. Everything was working from the first time. Really good job everyone.

I have one question. Is it possible to make HTTP or at least TCP requests? I want to send some data to server.

Great question! I was working on that last night. It’s actually working except for some bug in the Sequence numbers in the TCP Header (I have not released it because of the bug). It should be done within 1 day to 1 week… depending on how much time I have this weekend.

I’m glad it’s working well for you. Can I ask what brand/model router you are using. And does the DHCP and local naming work for you?

Thanks,
-Valkyrie-MT

@ Valkyrie-MT Thank you for you quick response. Loking forward to try your new code.
I’m using Netgear JWNR2000. DHCP works like a charm, but if I ping host MIP I don’t get any IP. I checked “Attached devices” in router administration, where I can see MIP with MAC address and IP address. I guess there is someting wrong with router’s DNS.

Are you using Windows XP?

try these:

ping
ping mip
ping mip.local

Also, if you capture a wireshark trace while you test “ping mip”, that would be VERY helpful in telling me exactly where the problem is.

-Valkyrie-MT

i tried all three of them. IP address works fine (but with one timeout), mip and mip.local don’t work (Ping request could not find host mip.local. Please check the name and try again.). I also made wireshark capture and upload it to http://www.sendspace.com/file/6s3mr4. I hope it works. If not, tell me how to get the file to you.

I have your wireshark file here and it was very informative! I think I know why the name resolution didn’t work. The computer you are pinging from and your Cerberus are on different subnets. Now this is a case I have never tested. But, I do know that NBNS and LLMNR will not work across subnets. And from your wireshark trace, I see your computer sending the name resolution requests and absolutely no response from the Cerberus, which likely means that the Cerberus never saw them – because they are on different subnets. Your IP addresses are 192.168.77.132 (PC) and 192.168.95.107 (Cerberus). If your subnet mask is the common 255.255.255.0, then the third number in your IPs would need to match, but one is 77 and the other is 95.

At this point we might need to discuss the layout of your network between the Cerberus and the PC. Now, I am actually not an expert on this, but it may be possible to make them actually be in the same network by changing the subnet mask in your router from 255.255.255.0 to 255.255.0.0. But, I have no idea if this would work with mip. It’s certainly something that should work, but it did not occur to me when I wrote mip, so who knows what it would do. Although, my guess is that it will work because I don’t think it does any IP address based subnet broadcasting…

-Valkyrie-MT

Ah. I have wireshark installed in my Virual Machine (VMWare Player). But I hade worng network connection selected (NAT instead of bridge). This is the reason for 192.168.77.X IP.
Now I tried again, but I have problems. When I run WebServerProgram exemple for the first time after Cerberus power up, I get to Link is now UP point. Log looks like this:

The thread ‘’ (0x2) has exited with code 0 (0x0).
Executing a Complete RESET at 06/01/2011 00:00:15
The thread ‘’ (0x3) has exited with code 0 (0x0).
Link is now up :slight_smile:

But after restart (stop debug and start debug) I get “Unable to Communicate to the Ethernet Controller” exception. Do you have any idea, what that can be? I tried to change ethernet cable, tried to rewire module again, but with no success. Maybe there is some hardware problem with my ENC28j60 module.

This is a very specific exception. It indicates that the Cerberus failed to connect to the ENC28J60 over the SPI connection (MOSI, MISO, and SCK). First check that the ENC28J60 controller has power and that one of the LEDs on the RJ45 jack are lit. Then, check you connection again. For Cerberus, you should be connecting to Socket 6 and using the Cerb40 Profile in MIP. The next version of MIP will have a dedicated Cerberus Profile.

-Valkyrie-MT

The answer to this is now yes. I just checked in a new version that does this. I have not yet labelled it a release though because I will make a few more changes to the HttpResponse object and don’t want people thinking this is a finished API.

I am very happy with the simplicity I achieved with the calls. Here is a sample:


     // ... Start Networking as usual (not shown)

     // This is a call to the OData REST web server hosted by netflix.    
     var r = new HttpRequest("http://odata.netflix.com/Catalog/Titles('BVIuO')/Synopsis/$value");
     var response = r.Send();

     if (response != null) Debug.Print("Response: " + response.Message);

All they examples can be found here: http://mip.codeplex.com/documentation

Is therer anybody who measured the throughput of this stack? I really would like to know how fast it is, especially in the combination of cerb40 and enc28?
Sending or receiveing data via TCP without processing the data, would be a nice test… Thanks!

Best regards,

Alex

@ Valkyrie-MT, thank you for that. I will try to connect my network module againt and try it with new Cerberus firmware.

As part of this checkin, I did time a full DNSlookup + HttpRequest + HttpResponse. That complete cycle averaged about 300ms. But, nearly all of the time was in the latency of each request to the server on the internet. The mIP Stack on the Cerb40 was able to repond to each TCP packet within about 10ms, so the stack will not be the bottleneck here unless you are talking to a local machine on the LAN. The 300ms is a worst case because mIP does not cache the DNS lookups yet.

But, at the moment, mIP will probably not work if the response exceeds a single packet (about 1.5kb).

Also, mIP works fine with the Aug 24 QFE2 Based firmware that was just released.

Thanks for the details, but how many bytes/s e.g. on a TCP connection can the stack achieve on a cerb40?

I get an unhandled exception, when I try to initialize with a static IP and later send an UDP packet. I tracked it to the Adapter.GatewayMac being NULL.
I cannot use DHCP, so how do I set the Gateway MAC address in the initialization code?

Networking.Adapter.IPAddress = new byte[] { 192, 168, 100, 8 };
            Networking.Adapter.DomainNameServer = new byte[] { 192, 168, 0, 254 };
            Networking.Adapter.Gateway = new byte[] { 192, 168, 100, 1 };
            
            Networking.Adapter.DhcpDisabled = true;

            Networking.Adapter.Start(new byte[] { 0x5c, 0x86, 0x4a, 0x00, 0x00, 0xdd }, "mip", InterfaceProfile.CerbuinoBee_Socket1_ENC28);

Try this:

Inside the mIP Networking.cs file, at the end of the Networking.Adapter.Start method, add this line:


if (Adapter.DhcpDisabled) PollingTimer.Change(10, 10000);

Then in your code, after you call Start, do a Thread.Sleep(2000) to allow the timer to fire do it’s work. It’s a little hacky, but it should work.

You see, the problem is that when DHCP is enabled, as soon as the ipaddress is set, I start to poll for changes to the address. And one of the things I poll for is the GatewayMAC which is necessary for other communication. But with static, that timer was never getting started. So, the command to get the GatewayMAC was never getting called… ARP.SendARP_Probe(Adapter.Gateway);

1 Like

This is very cool, and thanks for sharing…