UDP Terminal Protocol

If you are using UDP on a local segment, you're reasonably safe assuming things are in order and not fragmented unless you try to push the envelope with large PDUs.

Over a router of unknown configuration? Not so much.

Serial ports don't change the order of arrival or fragment :)

--
Les Cargill
Reply to
Les Cargill
Loading thread data ...

A rudimentary "simple-tcp" that is not quite compliant with TCP but will interoperate with one that is is not much code. You will have to handle a connection or maybe a handful, but not very many. You will have to do retransmissions, but you can back off to a constant, semi-high value (like 6 seconds) on the second attempt. You can deny all options, and stay with a small window of a few k, and send 512 bytes or less.

That should reduce the requirements to a few hundred lines of code beyond implementing UDP.

You can also have a very rudimentary telnet negotiation, basically enforcing a standard set of options and accepting nothing else.

You probably have to have some default IP address, which you can change. Making a simple udp one-shot protocol to set such options should be easy.

A "simple-TCP" will handle this, and you could make a udp simple config-setter like the ones digium does for the iaxys should be an afternoon's work.

You will be amazed on how much chatter, duplications and other stuff I have found on ethernets.

-- mrr

Reply to
Morten Reistad

That turns out to be surprisingly difficult. It's not a lot of code, but no two clients behave the same, and the first time you trie a new client, you find a new problem.

One clever method for establishing an initial IP address that I've seen is that the embedded device watches for unicast IP packets sent to its MAC address. When it sees one, it temporarily adopts whatever destination IP address was in the packet. That way, to initially configure the device's IP, all you have to do is add an entry to your host's ARP cache with the desired IP address and then ping that IP address. IIRC, the device in question only did this if the device was at factory defaults.

--
Grant
Reply to
Grant Edwards

Or you could just use IPv6: router broadcasts Router Advertisements containing the local network prefix. Client picks that up, appends its MAC address, it now has its IP. Everyone else can work out the IP too. This is not special 'factory defaults' magic, it's how IPv6 works all the time.

Theo

Reply to
Theo Markettos

A basic HTTP server needs surprisingly little. The one in our library is a bit over 2KLOCs (and there's some utility stuff which can expand that), but can be built in iterative, select/state-machine and threaded models, and has a few features not strictly needed. A simple, iterative only, model could probably be squeezed into half that.

Obviously it's no threat to Apache's dominance, and the web programming is pretty low level. I cobbled the following up in a couple of minutes:

int p_index(void) { int i; time_t rawtime; struct tm * timev;

SendHTMLTextHeader(); if (MethodHEAD()) return 1;

SendHTMLText( "" " " "Hello world!" );

time(&rawtime); timev = localtime(&rawtime); SendHTMLprintf("It is: %s", asctime(timev));

SendHTMLprintf("The passed (%i) parameters are:", parmcount); for (i=0; i

Reply to
Robert Wessel

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.