Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,

Is it possible to select multiple files and send in a single socket programming in C program? I am using TCP/IP Protocol.
Posted
Comments
Sergey Alexandrovich Kryukov 28-Jan-16 1:18am    
Yes, of course. There is no difference how many files. It's just a matter of your application-layer protocol.
—SA
venkat28vk 28-Jan-16 1:23am    
@Sergey. I have already developed code to send and receive files for single direction and also bi-direction. The real question is whether it is possible to select multiple files in a UI and send and receive it back.
Jochen Arndt 28-Jan-16 4:30am    
You should use the Reply button right of a comment to answer like I have done now. Than the poster of that comment will get an email notification. Otherwise he would see your post only when coming back to this question.

However, Sergey's answer would be still the same. You must implement some kind of protocol.

An example would be sending a header first that contains the necessary information (size of header, number of files, list of files with name, size, and optional file attributes) followed by the file contents. The receiver than knows at which position a specific file starts using the size of the header and the file sizes.

1 solution

Yes of course, sockets accept a collection of bytes, how those bytes are assembled and where they came from is not their concern, that's the application's problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900