1

I want to check whether or not this connection is made. I am fairly new with node js and tftp so I am not sure how to check the connection. Can i return some kind of status?

var tftp= require('tftp');


var client = tftp.createClient({
    host: "192.168.0.184",
    port: 69
});
lord
  • 59
  • 1
  • 3
  • 15

2 Answers2

1

If you mean the Trivial File Transfer Protocol then it's based on UDP which is connection-less, so there's really no way to check the status of a "connection" that doesn't exist.

TFTP is basically a request-response type of protocol, so the only way to "check" a connection is to send a "request" and see if you get a "response" within a certain amount of time. If the response takes to long then something went wrong (dropped packet or something similar) and you have to start over.

Of course, if there's no-one listening on the other side then you can't even send the "request" and will get an error.

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
0

Do you see any error messages when you try to create a getStream:

var get = client.createGetStream ("remote-file.txt");

I suggest you first check if the tftp server is up and working. Eg in ubuntu you can check that by:

user@12345689:~$ sudo service tftpd-hpa status
● tftpd-hpa.service - LSB: HPA's tftp server
   Loaded: loaded (/etc/init.d/tftpd-hpa; bad; vendor preset: enabled)
   Active: active (running) since Tue 2020-05-12 19:29:40 PDT; 12h ago

Sometimes the firewall can get on the way

user@12345689:~$ sudo service ufw status
● ufw.service - Uncomplicated firewall
   Loaded: loaded (/lib/systemd/system/ufw.service; enabled; vendor preset: enab
   Active: inactive (dead) since Wed 2020-05-13 07:30:16 PDT; 4min 22s ago

On the machine where you have tftp and on other remote machine you can test tftp by:

user@12345689:~$tftp
> get 10.0.0.50:remote-file.txt
received 2000 bytes
Rose
  • 2,792
  • 4
  • 28
  • 42