I've built successfully my server & client program in C, able to establish the connection and message can be sent from both side client <-> server.

Pls help me to deploy for:-
(1) How to transfer file?
(2) If i enter command e.g.
- "pwd" in client side, current directory of server will be displayed.
- "dir" in client side, files of server's folder will be displayed

Sincerely Thanks!

Recommended Answers

All 2 Replies

(1) Server must send (write()) the bytes to the client (make sure the client is aware that he is going to receive those bytes and knows what to do with them).
(2) Server must recognize (read()) "pwd" and "dir" so it can respond to client sending (write()) back a message (current directory or list of files/directories; client must be aware that he is going to get a reply).

I think that's simple enough. :)

PS. You can replace write() with send() and read() with recv() (I assume you are using BSD sockets).

Load file to be send in memory and pass that memory adress in ur send() buffer...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.