🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Andrew Gierth Thu, 29 May 1997 00:00
Re: PART DEUX: Problems writing a port responder under HP-UX 9 (inetd responder)
#1
Author: Andrew Gierth
Date: Thu, 29 May 1997 00:00
29 lines
2031 bytes
>>>>> "Don" == Don Perkins <donperk@ix.netcom.com> writes:

 Don> BTW: Anyone else trying this will need to '#include <sys/unistd.h>' in
 Don> order to get the definition of STDIN_FILENO.

Should be #include <unistd.h> - I don't think sys/unistd.h is guaranteed
to exist.

 >> That's oversimplifying. getchar() will work, returning EOF when the
 >> socket is closed or encounters an error. There are some problems
 >> with using stdio on sockets, mainly related to signal handling, but
 >> it is still sometimes a useful technique.

 Don> In reference to using stdio with sockets:  My application will be
 Don> receiving a fixed length data record (a transaction request) and,
 Don> after some processing, return an updated version of the same record
 Don> back before closing the socket.  

If you do this with read() directly, you'll need to write your own loop
around the read (see the socket-FAQ examples) to cope with the possibility
of getting less data back from the read call than you asked for.

-- 
Andrew.

comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads