Sending a file to a server

Dear Experts,

please help i am very much confused here and not getting the right path,

actually i want to send a file from client to a server,
initially i used mmap() which is failing most of the time so i want to use general IO streams to do that,
i can open a file in "rb" mode
and read to a buffer by using malloc ,
after this i have to use send(buffer(empty, filesize) to send the contents ow to relate them please give me some good suggestion overall i want to replace mmap with general IO methods please tell me how to achieve send(from server)
recv(from client) to work properly.

There are examples of how to do this in almost every UNIX network programming book. I don't believe it to be productive or worthwhile for anyone here to answer this type of question because you will not learn anything by being told the answer.

Also the wording used to explain your problem lead me to conclude that this is a set exercise or assignment and we do not allow homework/classwork problems. I am therfore closing this thread.