2010-07-31
Hyperterminal “send text file” eats ASCII LF / 0x0A …
I stumbled across this problem because I was reading a protocol document for a device connected by RS-232. The document described what bytes to put in a text file, and how to use Hyperterminal’s “send text file” to send them. That all worked great. But as soon as I tried to get it working in C#, nothing nada zip. Unfortunately, “Line Feed” (ASCII LF, 0x0A) was one of those bytes.
This problem is mostly suffered by people trying to use Hyperterminal to send files to, eg: a microcontroller. But it looks like I’m not the only one to have stumbled upon this one:
“11 0d 0a 44 4d”
The document specifies it, hyperterminal eats it, and when my code actually sent it the device just ignores the whole message … Leave it out and bingo! The message, no longer corrupt, produces a response. What’s really odd is this: the device, when it replies, uses CRLF as its line separator. This raises the horrible suspicion that the alleged developers of this protocol wanted to send CRLF, found themselves stumped by Hyperterminal, and just gave in and changed the implementation instead of changing the protocol or using an non-broken client …
(if only it was a blood-pressure meter, that’d come in handy about now …)
Leave a Comment » |
Uncategorized |
Permalink
Posted by nickzoic
2010-07-02
Just a quick note for anyone trying to do FreeTDS through a tunnel or a firewall pinhole or whatever: If you specify an Instance name, FreeTDS goes and probes UDP 1434 to determine the port number for that instance, even if you also explicitly specify the TCP port number you want it to use. The problem being that often that UDP connection won’t get through, and FreeTDS will just time out with a “Read from SQL server failed”.
[whatever]
host = whatever.example.com
port = 1433
instance = foo
This isn’t really documented anywhere, and seems very counterintuitive, but if you look in the FreeTDS source, there it is in src/tds/login.c:
if (!IS_TDS50(tds) && !tds_dstr_isempty(&connection->instance_name))
connection->port = tds7_get_instance_port(tds_dstr_cstr(&connection->ip_addr), tds_dstr_cstr(&connection->instance_name));
So now you know. If you don’t specify the instance name, it notices that you’ve specified the port and just goes there directly. Filed it as a bug on FreeTDS, just for fun.
Leave a Comment » |
Uncategorized |
Permalink
Posted by nickzoic
2010-04-13
Did you ever wonder what happened to those socks which went into the tumble dryer and never came back? Perhaps they just turned bad … started hanging around in parks, selling smack to possums …
Drug raids uncover heroin-filled sock up tree
Leave a Comment » |
Uncategorized |
Permalink
Posted by nickzoic
2010-01-29
Sick of hearing about iPad yet? I am
Nonetheless …
Whether it is or isn’t a glorified iPod Touch, what’s most interesting about the device, for me, is that it _isn’t_ an ePaper device (like the kindle, &c). It’s battery life is pretty good anyway, but I guess the idea is you’d use it much like your phone … use it on batteries, but recharge early, recharge often.
It’s a pity though, because if anyone could carry off a stylish, minimalist user interface specifically designed for touchscreen ePaper, it’s Apple. Love them or loathe them, they do do design well.
Always on. No buttons. Just the bezel. Gestures at the edge of the display. Hand-drawn icons in charcoal. That kind of thing.
hmmm.
PS: just bought an iPhone, I wonder how it’ll go as a book reader?
Leave a Comment » |
Uncategorized |
Permalink
Posted by nickzoic