DNET_EOF(3)
π DNET_EOF(3) π
okay bestie, welcome to the Library Functions Manual section, we're talking dnet_eof today and honestly? it's giving β¨vibe check for your socketβ¨ π¦
πΈ NAME πΈ
dnet_eof β is your DECnet socket at End of File? asking for a friend π
π SYNOPSIS π
#include <netdnet/dn.h>
#include <netdnet/dnetdb.h>
int dnet_eof (int fd)
like it's SO simple, one little function, one little int, periodt π«Ά
β¨ DESCRIPTION β¨
so here's the tea, bestie β
dnet_eof returns 0 if the socket is not at end-of-file. that's the "we're still good, keep reading" energy π
it will return -1 otherwise, and errno gets set accordingly. and if the socket is at EOF? errno gets set to ENOTCONN. no cap, that's the whole thing π
okay important part:dnet_eofis only supported on Linux 2.4.0 or later. on earlier kernels it will always return-1anderrnowill be set toEINVAL. so if you're on some ancient kernel, that's your answer and it's not the one you wanted π
π§ EXAMPLE π§
here's a lil primitive server example that literally just prints out anything sent to it from the remote side. main character behaviour fr fr π
#include <sys/types.h>
#include <netdnet/dn.h>
#include <netdnet/dnetdb.h>
#include <stdio.h>
int main(int argc, char **argv)
{
int insock, readnum;
char ibuf[1024];
// Wait for something to happen (or check to see if it already has)
insock = dnet_daemon(0, "GROT", 0, 0);
if (insock > -1)
{
dnet_accept(insock, 0, 0, NULL);
while (!dnet_eof(insock))
{
readnum=read(insock,ibuf,sizeof(ibuf));
fprintf(stderr, "%-*s\n", readnum, ibuf);
}
close(insock);
}
}
see how it loops while !dnet_eof(insock)? that's the whole trick bestie, we stay in the loop until EOF says we're done πβ¨
π SEE ALSO π
dnet_addr(3)dnet_htoa(3)dnet_ntoa(3)getnodeadd(3)getnodebyname(3)getnodebyaddr(3)setnodeent(3)
go read those too, iykyk ππ
π and that's the page!! DECnet functions, July 28, 1998, DNET_EOF(3) π
okay ily, go check your sockets, mwah π«ΆπΈ
π¦ where this page comes from
- ubuntu jammy: libdnet-dev 2.65build2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms