I would like to know, how can two easy programs that transfer a text file from the sender to the receiver, send more than 65536 Byte (the maximum size of an IP packet).
This is the sender:

```
 FILE *fp=fopen("file_to_send.txt","r");
 char msg[65536];
 len = strlen(msg)+1;
 nwrite=0;
 printf ("write()\n");
 fflush(stdout);
 do{
   n=write(socketfd, &(msg[nwrite]), len-nwrite);
   nwrite+=n;
 }
 while( (n<0) && (errno==EINTR) );

```

and this is the receiver:

```
#define MAXSIZE 65536
.....
char buf[MAXSIZE];
nread=0;
do{ 
  n=read(socketfd, &(buf[nread]), MAXSIZE ) ;
  fflush(stdout);
  nread+=n;
}while( (n<0) && (errno==EINTR) );

```

It works if file\_to\_send weight is < than 65536 but if it's bigger I lose parts of the text.
Sorry for my bad English.