03-13-04 11:33 AM
Sal wrote:
> Hi all,
>
> Just hoping somone could point in the right direction. Have just started
> learning to program sockets and have programmed both a client and server t
o
> send and recieve messages, but now need to develop a web server to deliver
a
> web page. Obviously the server program would not have to change much, but
to
> send a file rather than a message, and I am using a browser as the client.
> Any suggestions to what I should be looking at to enable the ability to gr
ab
> the file and deliver it??
>
> TIA
>
>
Hi,
You can use a while() loop to send a file - line by line. Something like
while(fgets(line,1024,fp) != NULL)
{
write(sockfd,line,strlen(line));
// anything else you want to do
}
I coded one such web server-client application in PERL. Hope the same works
in C.
regards,
GVK
--
Happy Hacking!!!
[ Post a follow-up to this message ]
|