Kragen's second C .signature puzzle

Last updated 1999-07-12.

You're probably here at this page because you were curious about this program:

char a[99]="  KJ",d[999][16];main(){int s=socket(2,1,0),n=0,z,l,i;*(short*)a=2;
if(!bind(s,a,16))for(;;){z=16;if((l=recvfrom(s,a,99,0,d[n],&z))>0){for(i=0;i<n;
i++){z=(memcmp(d[i],d[n],8))?z:0;while(sendto(s,a,l,0,d[i],16)<0);}z?n++:0;}}}

Here I have a line-by-line explanation and how to run it. It works with another tiny program.

By the way, to make it work properly under Linux, the part that says socket(2,1,0) should be changed, but I don't know how. The second argument should be the Linux value of SOCK_DGRAM.

It might run on non-Unix systems, but I've only tested it on Solaris.


Kragen's home page