Node net weirdness

I spent some time debugging my gopher-client, it would sometimes receive the whole file, and other times only a part. The problem turned out to be not in the client, but in the server. It seems that large amount of data to a socket, and then ending it can cause the connection to be dropped before all the data is sent. I'm not sure what I'm doing wrong, but basically, when using two node scripts, one client, one server, then the following fail half the time: Server.js:
socket.write( tenMiBofData ); socket.end(); //Alternative, also fails: socket.end( tenMiBofData );
socket.pipe(someStream); socket.on('end', ()=>{ console.log('Got '+socket.bytesRead+' bytes.');});
So I came up with an alternative on the server side, which is ugly: Server.js:
if( socket.write( tenMiBofData ) ) { socket.end(); } else { socket.on('drain', ()=>{ socket.end(); }); }

This checks if the write call already drained the socket (the drain event

is not emitted, evne if subscribed before calling write), if the call did not leave anything in the buffer, then close right away, otherwise, subscribe to the drain event (I hope this is not racy, maybe it still is better to subscribe before write). Annoying thing, cost me a lot of time, doc mention nothing about it.

Announcing the gopher-lib npm package

Unfortunately someone already took the gopher name and used it for an express fork. I thought long and hard about which name I should take, overbite and bucktooth are obvious in hindsight, but they are also taken. I thought about "teeth" but it's slightly obscure, and I'm planning on adding packages for a fully featured server and client, which will use this library, so I kind of want to have the protocol name in there. So I chose "gopher-lib", then I an make "gopher-server" and "gopher-client" packages too, that kind of makes sense.

Old games

I just saw a video about Pentium 2, well, the video showed the game Incoming, I remember playing the demo of this on my P1 with a Voodoo card. I think I need to get my hands on Incoming and see how it fares in WINE with nGlide.. So.. It turned out that Incoming + Incoming Forces was on sale for $0.59 (-90%) on, so I bought it, even more lucky! I had a blance on my account so I didn't even have to whip my creditcard out! Awesome stuff! Now I just need to get back home to my real PC to try it out! :D Some day I must get a capture card that can do VGA in very high quality, and stream directly off my old Pentium 3 666Mhz machine that has a Voodoo 2 card :D But nope, the GOG version does not load any glide*.dll files, even if they are right there next to it, so I need to see if I can find a nocd-fixed 3dfx enabled binary to drop in some place, I guess that would be legal, since I own the game, or what? :S