socket.sendfile question (or general file transfer)

D

djc

the system.net.sockets.socket class has the 'sendfile' method. What do you
do on the other end to 'receive' the file? I know the regular socket.receive
will receive the data into a buffer (a byte array) but if that is how you
are supposed to receive the file how do you make it 'the file' again? Lets
say I send over a text file, or a binary file, or whatever, how does it get
back to its original format? Or am I way off base to begin with? should I be
using something else to send files in a client server or peer to peer type
setup?

any input on this would be greatly appreciated. Thanks.
 
V

Vadym Stetsyak

IIRC SendFile after transferring file will close the connection. Also you
can specify prefix and suffix data for the file. This tokens can be detected
on the remote host.

In the prefix data you can specify file name and file size so that remote
host could save the file.

Another way is to define your custom protocol where you will specify file
name and send file using common Send
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Socket.SendFile. 0
newbie socket question 1
file transfer with sockets 10
C# file Transfer 3
file transfer help? 2
TCPClient Losing Data 3
Detecting Disconnected Socket 3
Socket disposing after some time 1

Top