"But i didnt get what exactly is 2 bytes 1024 bytes."
Each Messaging protocol has sever parts:
for example 1st 2 bytes tell the protocol type, second 2 version, third 2 tell what type of packet is this and in last the original message on several bytes: This was just an example.
So when you want to send your file you need to write your own protocol which will be agreed by both the parties.
for example you create a simplest Packet Type with 2 byte header and 1024 byte for data:
Firts to bytes will tell what type of data is in the folling 1024 bytes.
like first 2 byte will tell the follwing 1024 bytes include file name and length.
so you'll parse the follwig bytes to the file name and get length.
Other message's header tell that the follwing bytes are bytes from file then you will receives those bytes and write the the received file.
I hope you understand it well now.
"And also i want to know whether there is a function for receiving files like send file() function in .NET2.0....."
No there is not function ReceiveFile and I have never used SendFile to because its not effective. Its a Synchronous Method which halts the GUI until it finishes sending all the file bytes to the receiver.
I think it simply reads bytes from the file and sends them to other party. But really I dont feel any charm in using it. Its better to develop your own scheme.
Best Regards,
|