Subject: Re: Dumb/silly network programming question
To: #List NetBSD current users <current-users@NetBSD.ORG>
From: Paul Goyette <>
List: current-users
Date: 12/10/2003 16:20:09
On Wed, 10 Dec 2003, Bill Studenmund wrote:

> Since you're using a TCP socket, I'd suggest using read(), not recv().

Well, since I'm emulating the telnet protocol, I have to be able to
handle Out-of-Band data (flags argument=MSG_OOB), too, corresponding to
TCP's Urgent flag (unless I've made another blunder).  I don't see a
way to deal with MSG_OOB using read().

Anyway, I've managed to work around it by checking for retval==-1 and
errno==EAGAIN, and sending a Telnet IAC-NOP sequence to the client.
The write detects the broken socket and shuts things down on the server

Thanks for the feedback.

|   Paul Goyette   | PGP DSS Key fingerprint: |  E-mail addresses:   |
| Network Engineer | FA29 0E3B 35AF E8AE 6651 |   |
|  & World Cruiser | 0786 F758 55DE 53BA 7731 | |