Defines | Functions

echo.h File Reference

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <signal.h>
#include <errno.h>
#include <sys/wait.h>
Include dependency graph for echo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MAXLINE   256
#define DEFAULT_PORT   12345

Functions

void str_echo (int)
void Writen (int, void *, size_t)
ssize_t Readline (int fd, void *ptr, size_t maxlen)

Define Documentation

#define DEFAULT_PORT   12345

Definition at line 11 of file echo.h.

#define MAXLINE   256

Definition at line 10 of file echo.h.


Function Documentation

ssize_t Readline ( int  fd,
void *  ptr,
size_t  maxlen 
)

Definition at line 54 of file util.c.

{
  ssize_t n;

  if ((n = readline(fd, ptr, maxlen)) < 0)
    perror("readline error");
  return (n);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void str_echo ( int   ) 

Definition at line 82 of file nse_server.c.

{
  ssize_t n;
  char line[MAXLINE];

  for (;;) {
    if ((n = Readline(sockfd, line, MAXLINE)) == 0)
      return;           /* connection closed by other end */

    Writen(sockfd, line, n);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Writen ( int  ,
void *  ,
size_t   
)

Definition at line 88 of file util.c.

{
  if (writen(fd, ptr, nbytes) != nbytes)
    perror("writen error");
}

Here is the call graph for this function:

Here is the caller graph for this function: