Click to See Complete Forum and Search --> : Can't close connection properly after CInternetFile::WriteString


Esa
April 9th, 1999, 07:31 AM
Hi,

I am using VC5

When I am using CInternetFile::WriteString I cant close the connection to the ftp server correctly, instead the connection stays in idle for a while and eventually it get timed out. This kind of effect doesnt happen when I am using ReadString or other read functions.

Example of my doings:

m_inetSession = new CInternetSession("FtpApp", 1, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE);

m_ftpConnection = m_inetSession->GetFtpConnection(m_IP, m_ID, m_pass);

m_inetFile = m_ftpConnection->OpenFile(file, GENERIC_WRITE, FTP_TRANSFER_TYPE_ASCII);

m_inetFile->WriteString("plaaplaa");

if (m_inetFile != NULL)
{
m_inetFile->Flush();
m_inetFile->Close();
delete m_inetFile;
m_inetFile = NULL;
}
if (m_ftpConnection != NULL)
{
m_ftpConnection->Close();
delete m_ftpConnection;
m_ftpConnection = NULL;
}
if (m_inetSession != NULL)
{
m_inetSession->Close();
delete m_inetSession;
m_inetSession = NULL;
}

Now if I take netstat after this I can see that there is one idle ftp session to the ftp server.

Question is: Is this normal and I am kind of stupid, or should that connection be closed right after closing that ftp connection?

I think this an interesting question cause there is always a limit in the ftp server how many logged users can there be at the same time. So if I have these idle ftp session there, those are reservin logins... right??? not right???

- Esa