[comp.protocols.tcp-ip] Question about echo-udp

pete@sunseeker.UUCP (Peter R. Carpenter) (08/04/89)

I've got this little program to implement echo using tcp/udp-ip.  I call 
gethostbyname(), and getservbyname("echo","udp") and get back reasonable 
hostent and servent structures, except that the h_addr in hostent for 
various machines is always a single character 'H'.

If I call getservbyname() with echo/tcp or other "well known" services it fails.
Its a Sun/NFS system, and there is a note in /etc/services which says the file
is ignored when yellow pages are operating. I'm not concerned with yp's or
sun-ism's at this point in time.

Call socket() with DGRAMs, and connect(), return OK. Am I really connected?

I get a string from stdin, and write it to the socket, sleep for a few to 
let things percolate. Write length is correct, but the read off the socket 
returns -1, Nobody home? A second read returns 0.

Any ideas? 

---
Pete Carpenter, Cirrus Logic Inc, 1463 Centre Pointe Dr, Milpitas, CA 95035
{amdahl,ames,apple,bunker,pyramid}!oliveb!tymix!cirrusl!pete   408-945-8300
---------------------------------------------------------------------------