Main Content

close

Close connection to FTP server

Description

example

close(ftpobj) closes the connection to the FTP server associated with ftpobj.

Examples

collapse all

Open a connection to an FTP server. Then close it when your session is finished.

First, connect to the National Centers for Environmental Information (NCEI) FTP server.

ftpobj = ftp('ftp.ngdc.noaa.gov')
ftpobj = 

  FTP Object
     host: ftp.ngdc.noaa.gov
     user: anonymous
      dir: /
     mode: binary

Show the contents on the server, and retrieve the README.txt file.

dir(ftpobj)
 
DMSP                         Solid_Earth                  google12c4c939d7b90761.html  mgg                          
INDEX.txt                    coastwatch                   hazards                      pub                          
README.txt                   dmsp4alan                    index.html                   tmp                          
STP                          ftp.html                     international                wdc                          
Snow_Ice                     geomag                       ionosonde                                                 
 
mget(ftpobj,'README.txt');

Close the connection to the FTP server.

close(ftpobj)

FTP service courtesy of the National Centers for Environmental Information (NCEI). See the NCEI Privacy Policy, Disclaimer, and Copyright for NCEI terms of service.

Input Arguments

collapse all

Connection to an FTP server, specified as an FTP object.

Tips

  • If you do not run close at the end of your session, then the connection either times out automatically or terminates when you exit MATLAB®.

  • After calling close, calling any other FTP function on the same object automatically reopens the connection.

  • close does not return any output to indicate success or failure.

See Also

Introduced before R2006a