Wednesday, February 18, 2009

Deadwood update: DNS-over-TCP now works

I have released an update to Deadwood today that implements simple TCP buffering; this is a simple TCP buffer that allows data to be forwarded over TCP. The buffer only allows data to be sent one direction to be buffered; the data is buffered until it is possible to send the data.

While there is data in the TCP buffer, the Deadwood TCP client does not accept any further data on that particular connection until the buffered data is sent and flushed.

The TCP connection in question has the actual buffered data and the socket (incoming or outgoing, basically) and length for the buffer stored. When the buffered data is sent, the buffer is cleared.

While there is buffered data, the program repeatedly does a send() system call to send the data until it succeeds. There is no delay; the send is sent to the kernel as quickly as possible over and over until it succeeds; I wonder if the loop that processes the TCP data should have a 1-ms delay or what not to not hammer the kernel with send() calls while there is buffered data to be sent.

The TCP buffering does not support partial send()s; the data either is sent or not sent. In other words, if send() tries to send 40 bytes of data, and only 20 bytes are sent, the program puts a warning on the standard output that partial sends of data are not supported.

This may be an issue for complicated TCP packets, but seems to work fine for basic DNS-over TCP packets.

In addition, the code doesn't check the output of memcpy when making the buffer.

This code can be downloaded at this link.

Since I last tried using Chortle as a screen font, anti-aliasing and auto-hinting have greatly improved. I have download a package from Microsoft to enable ClearType hinting on Windows XP, and use aggressive hinting in Ubuntu.

With modern sub-pixel anti-aliasing, Chortle is remarkably readable on the screen and I'll use it, as much as possible, as my primary screen font until the end of February, to see if I can break my inability to look at anything besides Verdana for extended periods of time on the screen. I don't like the idea of my eyes and computer screen being bound to a proprietary font (albeit one that is a free download).