Go Down

Topic: enc28j60 tcp server (Read 1 time) previous topic - next topic

lorenzop

this seems to be the best, most up to date library for the ethershield. https://github.com/jmccrohan/EtherShield so that's what I'm using. it has a web server example, but what I need is a tcp server. it sounds easy enough, but no. does the library have the code to support it already? I see constants for things like WWW_client or server, but I don't see anything like TCP_server. it's a complicated library. I first need to figure out if the functions I need exist, or do I have to modify the library and add functions?

lorenzop

#1
Dec 30, 2011, 12:31 am Last Edit: Dec 30, 2011, 01:40 am by lorenzop Reason: 1
I still haven't found any useful libraries online. I've found more posts where people talk about creating a library that's compatible with both shields, but I can't find that anyone has ever started such a project. I know I can't handle a project like that on my own, but I will gladly offer any help I can if someone else heads up the project. my plan right now, is to create a semi-simple library to just act as a compatibility layer to make the ethershield library in my previous post act more like the official ethernet library. if I run into any road blocks, and I expect I will, I'll end up having to modify the library itself and release my own version of it. in either case, the code will be in my own subversion repository, so I can patch in updates to the library I'm basing mine from. anyone care to help with any of this?

edit: I found this library https://github.com/thiseldo/EtherShield seems the most up to date version, so that's what I'm working with. I think what I need to do is make copies of the functions that are called in http server examples, and strip out the http code. every time I look at the code, it's much more complicated than it seemed it would be.

zoomkat

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

lorenzop

#3
Dec 30, 2011, 06:54 am Last Edit: Dec 30, 2011, 07:03 am by lorenzop Reason: 1

Is all that worth saving ~$23?


quick answer, no it's not. I have one with the bigger sd card holder, and it works fine. but my goal is to have my project working with both types of ethernet shields. when I upload my finished code to the internet, I want people to be able to download it and use it with either shield without trouble.

I think I'm close to having a compatibility layer I can use, but I'm having trouble with the packets. the library does some complex stuff in the packetloop_icmp_tcp function. I can get my code to show that it is getting packets, but I can't get it to detect the right kind of packet so I can grab the data from it.

edit: it would even help if I knew how to properly debug the library. there's some kind of debugging built into it, but I don't have a clue how to use it. UDR0? I was taking a guess that it's some internal name for the serial port, but it doesn't send anything to the usb serial port. swapping that code out for Serial.print() just gives errors that it hasn't been defined yet.

lorenzop

#4
Dec 30, 2011, 09:30 am Last Edit: Dec 30, 2011, 09:48 am by lorenzop Reason: 1
figured out why I wasn't getting the packets with the usual es.ES_packetloop_icmp_tcp function. it's not looking for the GET line of the http protocol, but it is waiting for the double line endings \r\n\r\n to signify the end of the http header. that is the hidden problem when trying to convert the web server example into a tcp server. it must be hidden in that function. I'll dig into it more tomorrow.

edit: or maybe the packet was to short. my test data was "12345". it seems to only work when sending strings at least 8 characters long.

Go Up