Valks / tftp.net

C# TFTP Server and Client
Microsoft Public License
8 stars 5 forks source link

Unable to get the copied file location. #1

Open manishi2V opened 6 years ago

manishi2V commented 6 years ago

I am running the same code and line no. 21 of client Program.cs is client.Download("EUPL-EN.pdf"); I ran the server program first and then client program. There is a file in the server bin folder named as "EUPL-EN.pdf". Everything works fine and file transferred completed message shown in the console, but i didn't get the file in the client side. I have checked the bin folder of the client but the file is not there.

Another issue is when I am using client.Upload("EUPL-EN.pdf"); Then file transfer with 0 bytes.

Valks commented 6 years ago

It has been a while since I last used this code but I can confirm the server side works in the netcore branch (didn't use the client code).

This is taken from another codeplex repo and as the name of the branch suggests modified to use netcore.

Taking a quick look at the commits I see some changes related to the file path and to make it working using async / await. It should also be modified again for .net standard 2.0 and msbuild.

I'll try and take a moment tomorrow to look at the project where I'm using this code and check it against the sample app to see if there's an issue.

manishi2V commented 6 years ago

Resolve: You are not sending the file size in the MemoryStream. Stream stream = new MemoryStream(File.ReadAllBytes(@"tftp.net-master\tftp.net-master\Tftp.Net.SampleClient\bin\Debug\a.bmp")); Need to write this in client's program.cs

tr14466 commented 5 years ago

I am running the same code and line no. 21 of client Program.cs is client.Download("EUPL-EN.pdf"); I ran the server program first and then client program. There is a file in the server bin folder named as "EUPL-EN.pdf". Everything works fine and file transferred completed message shown in the console, but i didn't get the file in the client side. I have checked the bin folder of the client but the file is not there.

Another issue is when I am using client.Upload("EUPL-EN.pdf"); Then file transfer with 0 bytes.

Hi,@manishi2V client.Download("EUPL-EN.pdf") How to save a file to local computer client.Upload("EUPL-EN.pdf") How to upload local computer files to server How did you solve these problems?

IDHSRG commented 1 year ago

If you want to save file - use FileStream with path to file instead of MemoryStream, 'cuz you download data in stream, which closes immediately after transaction. I hope you understand me...