Giter Site home page Giter Site logo

tftp.net's People

Contributors

bmburstein avatar callisto82 avatar hiowaguy avatar m-tmatma avatar pyrostew avatar robeving avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tftp.net's Issues

Data Packet Block Number 0 Occurs on Large Data Files

Sending a large data file (hundreds of megabytes) results in the transfer eventually reaching data packet with block number 65535. The next data packet should be sent with block number 1 per the TFTP specification, but instead block number 0 is sent which may be rejected by the peer.

Exception From SendOptionAcknowledgementBase When errorMessage Is Null

I have run into an issue where an unhandled exception is raised that terminates my program when the software I'm communicating with responds to an option acknowledgement with a TFTP Error with no message. I don't seem to be able to handle the exception from my code since it's raised from the context of the UdpChannel (BeginReceive) thread.

Sequence:
(Me => My Program with TFTP.NET)
(Them => The External Software)

Me:
Opcode: Option Acknowledgement (6)
Option: ...

Them:
Opcode: Error Code (5)
Error Code: Illegal TFTP Operation (4)
Message: 0x0 (NULL)

Here is the stack trace I see for this:
System.ArgumentException: You must provide an errorMessage.
at Tftp.Net.TftpErrorPacket..ctor(UInt16 errorCode, String errorMessage)
at Tftp.Net.Transfer.States.ReceivedError..ctor(TftpTransfer context, Error error)
at Tftp.Net.Transfer.SendOptionAcknowledgementBase.OnError(Error command)
at Tftp.Net.Error.Visit(ITftpCommandVisitor visitor)
at Tftp.Net.Transfer.States.StateThatExpectsMessagesFromDefaultEndPoint.OnCommand(ITftpCommand command, EndPoint endpoint)
at Tftp.Net.Trace.LoggingStateDecorator.OnCommand(ITftpCommand command, EndPoint endpoint)
at Tftp.Net.Transfer.TftpTransfer.connection_OnCommandReceived(ITftpCommand command, EndPoint endpoint)
at Tftp.Net.Channel.UdpChannel.RaiseOnCommand(ITftpCommand command, IPEndPoint endpoint)
at Tftp.Net.Channel.UdpChannel.UdpReceivedCallback(IAsyncResult result)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.ContextAwareResult.CompleteCallback(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

Sign the assembly in the nuget package

It's annoying if we have to add al lthe source code to our project just for the sake of signing it. This makes it so much harder to get the latest version as you would normally do through nuget.

Any chance you can sign the assembly by default?

RFC 2347 Options Extension

Hi,

i didn't quite understand how to define additional options to a transfer.
as I saw in the code, the TransferOption class is internal.
I didn't saw a UnitTest which send\receive data with with additional options.
How do i use this capability.

Thanks

SampleClient produces a System.ObjectDisposedException exception

From master/Tftp.Net.SampleClient/Program.cs

//Start the transfer and write the data that we're downloading into a memory stream
Stream stream = new MemoryStream();
transfer.Start(stream);

//Wait for the transfer to finish
TransferFinishedEvent.WaitOne();
using (var reader = new StreamReader(stream))
{
	stream.Position = 0;
	Console.WriteLine(reader.ReadToEnd());
}

Produces a System.ObjectDisposedException: 'Cannot access a closed Stream.' when server does not accept any options (RFC 2349, RFC 2347, RFC 2348).

This can be fixed in the client sample using Encoding.ASCII.GetString(stream.ToArray()) (ToArray is a MemoryStream method) instead of the StreamReader. However this does not provide a good fix for the underlying problem. I did not look into why the Stream is disposed too early. When the server accepts the options the implementation is fine and works as expected.

TFTP Client Get & Put problem

Hello,TFTP Client problem.
1、Get file:How to save a file to local computer
2、Put file:How to upload local computer files to server
Ps: Can give a detailed example

Create an own nuget package

Hi Michael

Can you create an own nuget package? You must register a nuget.org Account and create an api key. After that you can publish your own package to nuget.org. Also an option is to automate this step with appveyor.

I can help you with this steps?

Best regards
Tino

how can i use this library in a form project

i try it can run in a console project, but i don't know how to use this library in a form project, as i add the sample code in my form project, it just can't work. hope for your help. thanks a lot.

LoggingStateDecorator class

FYI - on a Xamarin.iOS project, System.Diagnostics.Trace.WriteLine(message, transfer.ToString()) in TftpTrace class causes transfers to be very slow in a debug session. I believe its because of the overhead required to print the transfer messages on the debug screen in Visual Studio. I've done some testing and transferring 800mb with WriteLine takes ~10 minutes vs ~80 minutes with WriteLine.

I created a public bool called WriteTrace in TftpServer and TftpClient then passed that to LoggingStateDecorator with if (trace) above TftpTrace.Trace(). May want to consider it in future releases.

Unhandled exception due to race condition in timer construction

this.timer = new Timer(timer_OnTimer, null, 500, 500);

You create the timer before the state variable is set. You should move the construction of the timer to the very last statement in the constructor. That way you can be sure that 'this' is valid.

In its current state it is possible to get an unhandled exception which crashes the program. You might think that this is rare but in my set up I can trigger this >30 times in 24 hours.

System.NullReferenceException: Object reference not set to an instance of an object.
   at Tftp.Net.Transfer.TftpTransfer.timer_OnTimer(Object context)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.TimerQueueTimer.CallCallback()
   at System.Threading.TimerQueueTimer.Fire()
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

As you are creating a timer you might want to consider an exception handler in the callback as any exception there will cause a unhandled exception and kill the program.

Unable to get the copied file location.

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.

TftpTransfer fallsbacks to default rather than proposed?

internal void FinishOptionNegotiation(TransferOptionSet negotiated)
{
NegotiatedOptions = negotiated;
if (!NegotiatedOptions.IncludesBlockSizeOption)
NegotiatedOptions.BlockSize = TransferOptionSet.DEFAULT_BLOCKSIZE;
if (!NegotiatedOptions.IncludesTimeoutOption)
NegotiatedOptions.Timeout = TransferOptionSet.DEFAULT_TIMEOUT_SECS;
}

Is there a reason behind this? This essentially blows away whatever settings are currently set on TftpTransfer. The TFTP server I am uploading to does not support option negotiation and must have a block size of 256, which is currently not possible as the code stands.

Very slow transfer of a boot.wim file

the transfer of a boot.wim file works very slowly. Is there any experience about this?

Environment
Physical Windows 10 client with running PXE (and TFTP.net)
Virtual Virtualbox client (on the same computer) making a PXE request.

grafik

The transfer is very slow and ends with an error after a few percent:
grafik

Does TFTP.net support special options to support it for Microsoft Windows deployment?

Server does not transfer files when connecting from a different machine

Using the TFTP Server code provided, the program works fine to transfer files as long as the connection is from within the same machine (using the loopback connection, for example). However, when trying to connect from a different IP address, I get multiple connection attempts all from the same client from the line below:

OutputTransferStatus(transfer, "Accepting request from " + client);

And then the connection times out. I am using the Windows TFTP Client as my client to connect to the server. Any help anyone can give would be much appreciated. Thanks.

No Documentation

This library looks good, though I have no idea how to use it because there is no documentation at all. The examples don't give a clue on how to use the upload function. I searched for hours but could not find anything, where to find the documentaion?

Unable to send file (with filepath)

Hi, I'm sorry for this easy and simple question but I'm a newbie in coding.
I'm trying to upload a firmware file choose from user on a tftp server with your library, but if I call the upload function with the complete path of the file the IFTPTransferError give a 1 error (file not found).
Received error: 1 - File not found Transfer failed1 - File not found
If I try without filepath and copy my file in the debug folder the upload is finished without error .
The simple question in this case is: there is a way to upload file directly from the folder that user choose?
Thanks in advance for your reply.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.