---
name: "dnet_eof"
section: "3"
platform: "linux"
package: "libdnet-dev"
version: "2.65+b1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/dnet_eof"
---

# dnet\_eof(3)

Is DECnet socket at End of File ?

## NAME

dnet\_eof - Is DECnet socket at End of File ?

## SYNOPSIS

**#include \<netdnet/dn.h\>**\
 **#include \<netdnet/dnetdb.h\>**\

**int dnet\_eof (int fd)**

## DESCRIPTION

**dnet\_eof** returns 0 if the socket is not at end-of-file. It will return -1 otherwise, errno will be set accordingly. errno will be set to ENOTCONN if the socket is at EOF.\
 **dnet\_eof** is only supported on Linux 2.4.0 or later. On earlier kernels it will always return -1 and errno will be set to EINVAL.

## EXAMPLE

Here is a primitive server example that just prints out anything sent to it from the remote side:

```
#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 ALSO

[**dnet\_addr**(3)](/dnet_addr/3.md), [**dnet\_htoa**(3)](/dnet_htoa/3.md), [**dnet\_ntoa**(3)](/dnet_ntoa/3.md), [**getnodeadd**(3)](/getnodeadd/3.md), [**getnodebyname**(3)](/getnodebyname/3.md), [**getnodebyaddr**(3)](/getnodebyaddr/3.md), [**setnodeent**(3)](/setnodeent/3.md)
