Subject: Re: Dumb/silly network programming question
To: #List NetBSD current users <current-users@NetBSD.ORG>
From: Paul Goyette <paul@whooppee.com>
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
side.

Thanks for the feedback.


----------------------------------------------------------------------
|   Paul Goyette   | PGP DSS Key fingerprint: |  E-mail addresses:   |
| Network Engineer | FA29 0E3B 35AF E8AE 6651 |  paul@whooppee.com   |
|  & World Cruiser | 0786 F758 55DE 53BA 7731 | pgoyette@juniper.net |
----------------------------------------------------------------------