In c programming language I am trying to send afile from a socket to the client . I first sent the file size thenthe file content but for some reason it is not writing the contentto the file.
Client.c.Unless is their an easier way to do this and if soplease do not use fopen() or fwrite().
include <unistd.h>
#include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <string.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/sendfile.h>
#include <sys/stat.h>
#include <sys/socket.h>
int main(int argc, char *argv[]) {
int sockfd = -1
int portno = -1;
int conn = -1;
int file_size =0;
ssize_t len;
int n = -1;
struct hostent*server;
char buffer[256];
int fd =0;
if(argc