How to check tftp server is running?
#1
Posted 31 July 2008 - 08:29 AM
I have an application that transfer files using the tftp server tftpd32.
the user is requested to enter the tftp server IP.
Is there any command to check that a running tftp server exist on this IP?
Thanks,
#2
Posted 31 July 2008 - 11:09 AM
To check the service maybe you can try reading the error code outputted by TFTP.exe from windows when trying to download a file from a batch file (don't know if it is possible)
The adequate way to handle this procedure would be creating your own program to check the reliability of the TFTP server.
The protocol behavior is described here:
http://en.wikipedia....ansfer_ProtocolDetails of a TFTP session
* The initiating host A sends an RRQ (read request) or WRQ (write request) packet to host B at the well-known port number 69, containing the filename and transfer mode.
* B replies with an ACK (acknowledgement) packet to WRQ and directly with a DATA packet to RRQ. Packet is sent from a freshly allocated ephemeral port, and all future packets to host B should be to this port.
* The source host sends numbered DATA packets to the destination host, all but the last containing a full-sized block of data. The destination host replies with numbered ACK packets for all DATA packets.
* The final DATA packet must contain less than a full-sized block of data to signal that it is the last. If the size of the transferred file is an exact multiple of the block-size, the source sends a final DATA packet containing 0 bytes of data
Meaning you would have to code your way to send a WRQ to the TFTP server on port 69 and check if an ACK is sent back.
#3
Posted 31 July 2008 - 04:05 PM
jaclaz
#4
Posted 31 July 2008 - 04:55 PM
To check the service maybe you can try reading the error code outputted by TFTP.exe from windows when trying to download a file from a batch file (don't know if it is possible)
I'm not an expert on batch files but would you care to try or "find" if tftp.exe from windows is capable of this?
#5
Posted 31 July 2008 - 06:20 PM
That's why I said:
I'm not an expert on batch files but would you care to try or "find" if tftp.exe from windows is capable of this?
EVERYTHING (almost) is possible with BATCH files, why in my day .....
The output in Italian:
Y:\>tftp 10.2.7.1 get serveris.up
Tempo limite scaduto
The Batch:
@ECHO OFF SET Smallfile=serveris.up SET Address= SET /P Address=TFTP Server Address? IF NOT DEFINED Address SET Address=10.2.7.1 FOR /F "tokens=1,2,3 delims= " %%A IN ('tftp %Address% GET %Smallfile% 2^>^&1') DO ( SET Answer=%%A%%B%%C. ) IF %Answer%==Tempolimitescaduto. ECHO NO tftp server on %Address%
The output of the batch:
Y:\>testtftp
TFTP Server Address?
NO tftp server on 10.2.7.1
Y:\>testtftp
TFTP Server Address? 10.2.7.9
NO tftp server on 10.2.7.9
It needs to be adapted to the user language, and of course it can be modified to change default server address or to interrogate a number of addresses, or whatever.
....and we LIKED it!
jaclaz
#6
Posted 31 July 2008 - 10:25 PM
why in my day .....
Very true!
#7
Posted 04 August 2008 - 11:32 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users