0

It is probably relevant to other questions too. I need to build a simple TFTP server in C (octet mode only) that will work with most TFTP clients available today (I only need to implement the server).

opcode   //2 byte
filename // string (unknown size)
0        // 1 byte
mode     // string (unknows size, max 9 chars considering 'netascii')
0        // 1 byte

But I'm having a problem: the RRQ/WRQ packets have a unknown length field "filename" (and "mode"). Because my server needs to be generic, how can I implement this option? Create a ridiculously large buffer and wait until recvfrom() returns 0?

Thanks!

Chris
  • 4,425
  • 5
  • 34
  • 49
bomba6
  • 539
  • 1
  • 7
  • 21

1 Answers1

0

make the buffer no much larger than the payload size of an Ethernet packet... with TFTP recvfrom won't return buffers larger than that...

Pat
  • 2,670
  • 18
  • 27