TwIP - An IP Stack In a Tweet
Adam Dunkels writes "Inspired by the Twitter-sized program that crashes Mac OS X, I just wrote a really, really rudimentary IP stack called twIP, small enough to fit in a Twitter tweet. Although
twIP is very far away from a real IP stack,
it can do the first task of any IP stack: respond to
pings. The entire source code can be found in this 128-character-long tweet. For those who are interested in low-level network programming, a code walkthrough with instructions on how to run the code under FreeBSD is available here. The FAQ: Q: why? A: for fun."
The underlying system must provide a way for user programs to receive and send IP packets.
This is where I stopped reading. Just... no. This is just a program that echoes every single thing back to the originator.
Shit doesn't smell like roses when it is made to fits into a tweet or is in any other way related to Twitter.
--- Eat my sig.
He is talking about the IP Stack, not the computer science stack structure. Calling it an IP stack is an over-exaggeration. This is a cleverly written (no doubt) program using ICMP knowledge to ping back a response packet. Please dont call that a stack!!
Haha! This article is rated purple (2 levels above the lowest -- black) already. Wow.
Anyhow. The fact that the TwIP program requires an IP stack to work is the prime indication that it doesn't really do all that much. Since it can work with raw socket access, and switches the addresses around, well, props, but TFA's "header" code comment says this:
updating the ICMP checksum
which is then contradicted by the code comment before the address swap:
Since we only swap bytes in the IP header, we do not need to update the IP header checksum.
using ICMP and IP interchangeably..?
timothy, take this down. Now. It's your only chance to save face with this article.
Sounds kind-of like this.
I hope this isn't a new trend of 7337 |-|@(|0%$ to try to brag of their mad skill by seeing what code can fit in a Tweet.
The less the code doesn't mean better performance.
The less code can mean less functionality and error checking.
The less code does mean less documentation
The less code could mean harder readability.
We need less people taking their time and effort making unreadable small code and more effort in making good and useful applications and libraries. Granted such exercises may be useful to allow you to think of problems differently but you can get the same effect by changing languages say from C to LISP. Also these examples seem to take in include headers which accounts for thousands of lines of code, which are often limited to either the OS or even just the Programming language.
It is like me saying I can make a Web Browser using a shell script with 2 lines.
#!/bin/bash
apachectl start
If something is so important that you feel the need to post it on the internet... It probably isn't that important.
Very cool program! Taught me some things about IP. The program could be made one byte shorter by using for(;;) instead of while(1) and it is not strictly necessary to use "unsigned short" instead of "short" afaict. I wonder what other interesting programs that can be written in only 140 bytes.
Football Odds
It's not an IP stack at all (and requires one to function). It replies to a packet that is assumed to be a ping without any error checking. In other words, it's a very short, clever, but minimally functional ping function. The fact that it's short is nice, but that's about it.
impressive, huh?
The MAFIAA is a bunch of mindless jerks who will be the first up against the wall when the revolution comes
I wrote my own compiler/language just now. What it does is it disregards your entire source code and then outputs that mac crashing bug. I fail to see your point...
I'm a c/c++ fan but just because you can do something in less lines doesn't mean it is better. Maybe if you said that in your language the mac crash ap compiles to 80bytes and requires only 10 operations then i'd be impressed. Buuuut in that case then asm is the greatest language ever.
Yeah, but for(;;) loops forever, whereas while(1) only loops while 1 is true. It's completely different! What if 1 becomes false?!
No existe.