Main Site Documentation

Interfacing a web page to mIP managed stack on a Cerberus


#1

Hello everyone,

I am using Valkyrie-MT’s awesome mIP managed TCP/IP stack on a FEZ Cerberus with great success! Very solid and easy to work with!

My network knowledge is limited, and what I thought I could do may not be feasible, so I am reaching out to the community here for some help.

I have 2 devices on a particular subnet - one is a Windows 7 PC, the other a cerberus running a mIP based application (so far a simple web server). On the PC I want to run any browser, browse to a asp.net website on the internet, and have the code-behind of a page on that site broadcast a packet and receive it on the cerberus, which again is running an application built around Valkyrie-MT’s mIP framework.

If this is even possible, what kind of socket would I need to set up on the website’s code behind, and more importantly what would the corresponding approach be on the mIP side? I tried udp, and can see the packet’s go out but even with a breakpoint on the nic_onFrameArrived event, I never see this udp packet arrive. So maybe I need to go down a layer (layer3!), but without a socket to bind to on the mIP application, how can this be done?

I know I lack some expertise on networking but I am getting there, I just need some guidance and would sincerely appreciate getting pointed in the right direction :slight_smile:

Thanks in advance for any help you fellows can offer!


#2

[quote]I have 2 devices on a particular subnet - one is a Windows 7 PC, the other a cerberus running a mIP based application (so far a simple web server). On the PC I want to run any browser, browse to a asp.net website on the internet, and have the code-behind of a page on that site broadcast a packet and receive it on the cerberus, which again is running an application built around Valkyrie-MT’s mIP framework.
[/quote]

So to be clear, you want the ASP.Net web server to communicate back to the Cerberus. Can I ask why you need the added complexity of something in the middle?

Next question, the ASP.Net web server is actually NOT on the same network segment, you said it’s on the Internet? Assuming initiation from the ASP.Net server, can you guarantee your Cerb is accessible over the internet? Again another factor that makes me think you should avoid this host-in-the-middle scenario.

Can you articulate your reasoning for approaching it this way, or help us understand what the ASP.Net portion adds to the solution?


#3

Thank you for your reply Brett.

What I am really trying to accomplish is to have the capability to browse to a web site from a PC that is on the same subnet as my device ( a cerberus based device) and have a page on that site communicate with the device.

The Cerb is able to serve up a simple web page and can call a RESTful service on the net as well.

A light just came on :slight_smile: I see what you are saying, the asp.net server can only access the Cerb if I were to open ports on the router, OR if I had a small client exe running on the same PC that the browser is running on.

I really would like to be able to “access” the Cerb via the internet, that’s the whole point to the POC. So far I’ve been spinning my wheels, until you asked these questions!

Having the website download a small exe to the PC and that app access the Cerb is more realistic I think. Of course there are security concerns, but warning the user ahead of time and have them ackonowledge the download ought to be ok - like Click To Run does.

Am I getting closer to a solution? It’s almost midnight and I’m dozing off so I apologize if I’m not as coherent as I should be.


#4

Why don’t you control the Cerb through the same web server that is running on it.


#5

search for NetBIOS on codeshare… doesn’t that give you what you want? A discoverable way to find the Cerberus from your PC?

Why do you want an EXE?


#6

@ Architect - I did actually consider that. Sort of limited in what I can serve up, but would provide some capability at least.

@ Brett - I will check out NetBIOS, right now I am not at all famililar with it. I actually wasn’t too crazy about the Click To Run solution, just figured a “brute force” approach like an exe would solve it since the exe running on the PC would be a local program that would have no trouble communicating on the subnet that the Cerb was on.

I will check NetBIOS and see how that may work.

Thank you fellows for your suggestions and help!


#7

Here’s the scenario I’d like to achieve:
Suppose for example, I visit a company and we meet in a conference room. I plug my device into their network (security persmissions aside), it acquiires an address.

I then direct them to browse to a website on a computer in the conference room ( for now, assume same subnet - I know no guarantee but need to start someplace!).
From that website, they do some stuff, and send some data to the Cerb device.

@ andre.m - That’s what I essentially am trying to achieve. I have been mostly low level, such as doing global broadcasts on a socket at some specified private port. That way I would not have to worry about getting fancy with finding the device. Is this feasible as well? UDP is nice since it is connectionless, I thought I could blast a message over the subnet and if my device is there, we’d have a link.


#8

@ BigRunningBack - Maybe some inspiration… What i have done to access my .netmf device from a browser, without knowing the IP of my netmf device is as follow:

As soon the netmf device starts, it send it’s IP address to a webserver / domainname.
the webserver runs a IIS api filter (asp.net) and register the host ip and device ip (they belong together) (some kind of dns server)

From the browser, access the domain. the request see’s its comming from a host ip and respond with a redirect to the local netmf device IP.

you can also embed the local ip in your asp.net page and in the browser you have both ip’s and can do whatever you like.


#9

@ RobvanSchelven - thank you for the inspiration! Got me realizing the whole problem from the right perspective and possible ways to solve it!

There are 2 ip addresses that I’d have to consider. The one on the public side of the DMZ, and the local one. Obviously, to be totally transparent I wouldn’t want to be burdened with NAT translation of certain ports or the like.

Very interesting, but I feel that now I really “get” the situation and can proceed with coming up with a creative solution for it.

@ andre.m - I am extremely limited in what I can serve from my device as far as content. Browsing to a asp.net based site eliminates any restrictions - provided of course that I can talk to my device!


#10

If you’re limited, is that because of some preferred restriction you placed on yourself (or some power-that-be placed on you)? You can do a lot with these little devices !

I am guessing your application has some commercial aspect that means you can’t drop all the secrets here… which is fine.

I suspect that a “phone home” scenario that authenticates and pumps back a “local” IP address, that can then be used by a browser to redirect you to the device will work well for your scenario. If you think about this at scale though, you would need an ID for each device that you have, so that it reports its ID and IP back to base, the web page can then show you all devices in the field and their local IPs (or you can filter based on some sign-in or something perhaps).

Reporting back the internet-facing address will not work, unless you can also use uPNP to open a router port from the internet to permit an internet based connection to traverse back into the private network and route to your device - given the unknown of this private network it’s probably better to stay clear of even wanting that in the “first” setup, and leave the decision to the people who control that network. Even if you have the internet facing IP address, and a path back to it, you are unlikely to be able to reliably connect to it because many routers don’t reflect traffic to the external address back to an internal device.

Many things to choose from, many things to sort through, but certainly not an impossible task !


#11

@ BigRunningBack - Good luck !


#12

Thank you all for your helpful comments and advice! I have a design solution laid out and am building a POC now. Hopefully I have something useful I can share with the community after the dust settles!