0

hi i am just wondering how would you send a website through a socket as i am trying to make my own web server.

do you just open up the file, read the file and write out to the socket ?

openfile = open(home/username/www/index.html, "r"); 

n = read(openfile,buffer,256); 

n = write(newsock_filedesc,openfile, 256) ;
2
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by moroccanplaya
0

so you do not need to read in the html file ?

Line 4 reads the file contents into a buffer and then line 6 writes that buffer into a socket.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.