def ftp_connect(self, host, user='<STR_LIT>', password='<STR_LIT>', port=<NUM_LIT>, timeout=<NUM_LIT:30>, connId='<STR_LIT:default>'):
if connId in self.ftpList:<EOL><INDENT>errMsg = "<STR_LIT>" % connId<EOL>raise FtpLibraryError(errMsg)<EOL><DEDENT>else:<EOL><INDENT>newFtp = None<EOL>outputMsg = "<STR_LIT>"<EOL>try:<EOL><INDENT>timeout = int(timeout)<EOL>port = int(port)<EOL>newFtp = ftplib.FTP()<EOL>outputMsg += newFtp.connect(host, port, timeout)<EOL>outputMsg += newFtp.login(user,password)<EOL><DEDENT>except socket.error as se:<EOL><INDENT>raise FtpLibraryError('<STR_LIT>')<EOL><DEDENT>except ftplib.all_errors as e:<EOL><INDENT>raise FtpLibraryError(str(e))<EOL><DEDENT>except Exception as e:<EOL><INDENT>raise FtpLibraryError(str(e))<EOL><DEDENT>if self.printOutput:<EOL><INDENT>logger.info(outputMsg)<EOL><DEDENT>self.__addNewConnection(newFtp, connId)<EOL><DEDENT>
Constructs FTP object, opens a connection and login.
Call this function before any other (otherwise raises exception).
Returns server output.
Parameters:
    - host - server host address
    - user(optional) - FTP user name. If not given, 'anonymous' is used.
    - password(optional) - FTP password. If not given, 'anonymous@' is used.
    - port(optional) - TCP port. By default 21.
    - timeout(optional) - timeout in seconds. By default 30.
    - connId(optional) - connection identifier. By default equals 'default'
Examples:
| ftp connect | 192.168.1.10 | mylogin | mypassword |  |  |
| ftp connect | 192.168.1.10 |  |  |  |  |
| ftp connect | 192.168.1.10 | mylogin | mypassword | connId=secondConn |  |
| ftp connect | 192.168.1.10 | mylogin | mypassword | 29 | 20 |
| ftp connect | 192.168.1.10 | mylogin | mypassword | 29 |  |
| ftp connect | 192.168.1.10 | mylogin | mypassword | timeout=20 |  |
| ftp connect | 192.168.1.10 | port=29 | timeout=20 |  |  |