Sending bytes from Spinneret to Visual Basic
Moskog
Posts: 554
I been working on finding a way to transfer bytes from the Spinneret to VB without having to depend on HTML. I have some experience with programming VB from the VB 5.0 back in time but have very little experience with VB.NET or -net related programming. But so far I have made an application where I can receive and display HTML-based information on VB just like a browser. My spinneret is currently loaded with a modified version of Mike's HTMLGraph.spin. (Just added my own html-code and a few additions to the ParseResource-method).
What I would like to do is to be able to receive data like single bytes or packets of bytes from the Spinneret into VB through the Internet.
Like if I send the request from VB: 10.0.0.130:5000/sendData, the Spinneret should respond with sending the byte or the chain of bytes I want, clean without any html-tags.
I really believe this is a quite simple task but I have to admit I'm stuck. No more ideas on how.
I do think I need another addition to the ParseResource but I have no ideas on how it should look like.
So here I come creepin', asking for a good advice or a little snippet that can push me back on the track again!
Spinneret: HTMLGraph.spin
VB: Visual Basic 2010 Express
What I would like to do is to be able to receive data like single bytes or packets of bytes from the Spinneret into VB through the Internet.
Like if I send the request from VB: 10.0.0.130:5000/sendData, the Spinneret should respond with sending the byte or the chain of bytes I want, clean without any html-tags.
I really believe this is a quite simple task but I have to admit I'm stuck. No more ideas on how.
I do think I need another addition to the ParseResource but I have no ideas on how it should look like.
So here I come creepin', asking for a good advice or a little snippet that can push me back on the track again!
Spinneret: HTMLGraph.spin
VB: Visual Basic 2010 Express
Comments
Here: http://forums.parallax.com/showthread.php/144918-VB.net-and-the-Spinneret
I originally designed the Spinneret libraries for RESTful services. However, the community for some reason latched onto HTML. I guess I need to build another example.
http://code.google.com/p/propeller-w5200-driver/downloads/list
Make sure you get the zip that goes with the Spinneret => WebServer_W5100_RTC - Archive [Date 2013.02.20 Time 07.00].zip <= if you have a Spinneret. It will also work with the yet to be released WizNet fo5200 for Quick Start.
Unzip the attached .NET C# project and open the project in VS 2010. If you do not have Visual Studio or don't feel like installing VS for C# then simply drill into the folder HttpClientDemo\bin\Release.
You must update the app.config to point to your Spinneret IP address.
Execute (double click) HttpClientDemo.exe or run the project. It's pretty simple, turn LED 23 on and off. Play with the PIN and/or value textboxes.
The .NET code is open and free - happy programming.
Not much experience with C# here but I do have the Visual Studio with both VB and C# installed so maybe this is the time to convert, hehe. Should not be a too much of a difference.
Anyway, I will check out this tonight when back again from work.
Thanks again!
Awesome!
Repeating over and over... really do appreciate your help!
Use an xsl stylesheet for the xml. I use it all the time.
Here is my additions or modifications to the .spin file:
In DAT section:
In PRI RenderDynamic(id):
Added methode:
So if I type http://la3usa.com:5000/pessmar.xml/incoming/444
I receive this from the spinneret:
<root>
<Incoming>444</Incoming>
<Returning>888</Returning>
</root>
which is correct, but if I type things like http://la3usa.com:5000/pessmar.xml/incoming/45
I recieve this:
<root>
<Incoming>45
..see, no returning value at all. In VB I also get an error message.
Sorry for all this strange behaviors here but cant help for it!
You could also use a space character; ie $34, $35, $20. Regardless, you must update the spin source because a zero terminator in a text based protocol messes everything up.
What's still confuses me a little is the hexadecimals, like in line 70 in your original code:
I figure out they are some kind of placeholders and in this case they mean "0", "0". But I cant find a good explanation in the Propeller Manual (DAT-section) and it seems I can use any number here, also $32 or $33 and still get the same result. But I guess I have to stay in the range of $30- $39, anything else will just print the actual ascii-sign, right?