|
|
Comments and Discussions
|
|
 |

|
i don't have any prob compiling it.. everything ok using VS2010...
|
|
|
|

|
Well, turns out the issue was with me (surprise )...I had a mis-match of some other DLL's that the project used, and they showed up in the TCP/IP functions.
|
|
|
|

|
EncodeChars(&szIn[loop],&szOut[cnt],cnt);
should be
EncodeChars(&szIn[loop],&szOut[cnt2],cnt);
|
|
|
|

|
Hi all,
I need a secure FTP client.
I wrote:
SetSecurityEnabled(TRUE);
SetControlPort(21);//also tried port 990.
SetCertValidation(CERT_DONOT_VERIFY);
FTPConnect(...);
I get:
234 Using authentication type SSL
Can't create security credentials.
The FTP server sees:
AUTH TLS-P
504 Auth type not supported
AUTH SSL
234 Using authentication type SSL
disconnected.
It works fine without SetSecurityEnabled.
I use the latest Ultimate TCP-IP with its 3 latest updates.
Compiling using Visual Studio 2008, Unicode settings.
Running on Windows 7 64bit, tried also on Windows 7 32bit.
The FTPS server I am trying to connect to is my FileZilla FTP server.
Why does it say "Can't create security credentials." ?
Thanks!!!
modified 18 Jun '12 - 3:53.
|
|
|
|

|
The problem, basically, waiting for two Server Responses if STLS is being used, one in the SocketOnConnected(), and the other just after the call to Connect().
From: pop3_c.h - 1 change added m_bServerSaidHello
class CUT_POP3Client :public CUT_WSClient{
typedef struct MessageUIDTag {
long m_nMessageNumber; string m_strUID; } MessageUID;
typedef vector<MessageUID> MESSAGE_UID_VEC;
protected:
unsigned int m_nPort; int m_nPOP3TimeOut; bool m_bServerSaidHello;
From: pop3_c.cpp - 1 change, see "Added" line
CUT_POP3Client::CUT_POP3Client() :
m_nPort(110), m_nConnectTimeout(10), m_nPOP3TimeOut(10), m_bMsgOpen(FALSE), m_bTopOpen(FALSE), m_bReadMsgFinished(FALSE),
m_bReadTopFinished(FALSE),
m_bServerSaidHello(false) {
}
From: pop3_c.cpp - 1 change, see "Added" line
int CUT_POP3Client::POP3Connect(LPCSTR mailHost, LPCSTR user, LPCSTR password) {
int error;
if((error = Connect(m_nPort, mailHost, m_nConnectTimeout)) != UTE_SUCCESS)
return OnError(error);
if (!m_bServerSaidHello) if(GetResponseCode(m_nPOP3TimeOut) == FALSE)
return OnError(UTE_CONNECT_TIMEOUT);
...
From: pop3_c.cpp - This function totally changed:
int CUT_POP3Client::SocketOnConnected(SOCKET s, const char *lpszName){
#ifdef CUT_SECURE_SOCKET
int rt = UTE_SUCCESS;
BOOL bSecFlag = GetSecurityEnabled();
if (!(m_nPort == 995 && bSecFlag)) {
SetSecurityEnabled(FALSE);
if(!GetResponseCode(m_nPOP3TimeOut))
return UTE_CONNECT_FAILED;
m_bServerSaidHello = true;
if(bSecFlag)
{
Send("STLS\r\n");
if(!GetResponseCode(m_nPOP3TimeOut))
return UTE_POP3_TLS_NOT_SUPPORTED;
SetSecurityEnabled(TRUE);
}
}
if(bSecFlag) rt = CUT_SecureSocketClient::SocketOnConnected(s, lpszName);
return rt;
#endif
}
|
|
|
|

|
I have just discovered the hard way that CUT_BufferDataSource only handles character strings terminated with a NULL. It is not binary compatable. It uses strlen in the Open method.
The help file makes no mention of this limitation. The help file documentation needs tobe updated!
Fortunately CUT_FileDataSource has no such limitation. It is a reasonably straight forward replacement for CUT_BufferDataSource. The only gotcha is to create a temporary file name, I use for the filename s.Format("XX%ld.tmp", ::GetTickCount()).
The help file for this constructor suggests that if the file name is NULL then a local temp file will be created. It is not created. Again, the help file documentation needs tobe updated!
This library still gets 4.9999 out of 5 in my humble opinon.
modified 23 Feb '12 - 6:58.
|
|
|
|

|
I noticed it from the code.
int CUT_WSServer::ConnectToPort(unsigned short Port,int QueSize,short family,
unsigned long address){
if( WSAStartup(WINSOCKVER, &m_wsaData) !=0)
return OnError(UTE_ERROR);
memset(&m_serverSockAddr, 0, sizeof(m_serverSockAddr)); m_serverSockAddr.sin_port = htons(Port); m_serverSockAddr.sin_family = family; m_serverSockAddr.sin_addr.s_addr = address;
if((m_serverSocket=socket(AF_INET,SOCK_STREAM, m_nProtocol)) == INVALID_SOCKET)
return OnError(UTE_SOCK_CREATE_FAILED);
Is there anyway to make it a UPD Server?
thanks ahead.
|
|
|
|

|
virtual int ReceiveFile(LPCSTR sourceFile, LPCSTR destFile) If destFile is given as a simple name without path, for example, test.txt, in which folder would this test.txt be saved? I would like to set the default receive folder prorammatically. How? thx HR
|
|
|
|

|
You might use SetCurrentDirectory()
|
|
|
|

|
When receiving a large file, I would like to have an option to show a progress bar. Is this feature available? thx HR
|
|
|
|

|
I tried to use CUT_FTPClient::ReceiveFile in a pure console application. I use VC2005 and in MBCS, not UNICODE. My main purpose is to write a simplest console applicatioin code to get a file from a remote ftp server. However, I can not get out of compilation errors even after hundreds of trials. I copied the following files into my console app's folder. ut_clnt.h ftp_c.h UT_Queue.h UT_StrOp.h UTDataSource.h utfile.h utstrlst.h ut_clnt.cpp ftp_c.cpp UT_Queue.cpp UT_StrOp.cpp UTDataSource.cpp utfile.cpp utstrlst.cpp Please someone write a simpliest console program to receive a file from a ftp server using the above files. Simply receive a file and save it. In the meantime, I tried to modify FTPClient example - add main() as shown below - set the Entry point as main When I run it, it just silently terminates. I found that it terminates whenever it comes to 'new' operator to allocate memory. Can someone tell me what is wrong?
int main(int argc, char* argv[]) { CUT_FTPClient ftpClient; _TCHAR addr[256] = _T("..."); // enter your own ftp server for testing int port = 1250; _TCHAR user [256] = _T("anonymous"); _TCHAR pass [256] = _T("anonymous@anonymous.com"); _TCHAR account[256] = _T(""); int retcode = 11;
if (_tcslen(addr) > 0) { retcode = ftpClient.FTPConnect(addr,user,pass,account);// 'new' called inside if( retcode == UTE_SUCCESS) { //history.AddLine(_T("Connect Success")); int index = 0; // v4.2 GetMultiLineResponse refactored size_t size = 0; _TCHAR pBuf[MAX_PATH+1]; *pBuf = 0; while(ftpClient.GetMultiLineResponse(pBuf, MAX_PATH, index, &size) == UTE_SUCCESS) { index++; } } else { }
int retCode; _TCHAR filetoget[MAX_PATH] = _T("ELXLMT.zip"); _TCHAR filetosave[MAX_PATH]; _TCHAR buf[MAX_PATH+80]; // allow for text w/filename if(*filetoget == _T('\0')) { return 1; } if(*filetosave == _T('\0')) { _tcscpy(filetosave, filetoget); } retCode = ftpClient.ReceiveFile(filetoget, filetosave); if (retCode == UTE_SUCCESS) { _sntprintf(buf, sizeof(buf)/sizeof(_TCHAR), _T("File was saved to %s"),filetosave); } else { } if(ftpClient.Close() == UTE_SUCCESS) { } else { } } } thx
|
|
|
|

|
I've run into an issue with my BC patch (you may remember that I'm trying to use Ultimate TCP/IP in a Borland C program). I've got most of my features running, but have run into a bit of a snag...
Our program allows the user to start up the server, stop the server at any time, and re-start the server. So far, I can start the server with no problem, and I think I can stop it (a connected client shows that it gets disconnected). However, when I try and re-start the server, I get a 'normal' 0 return, but clients can no longer connect to the server.
It looks to me like I'm not completely closing off everything that needs to be closed when shutting down the server...
In a nut shell, here's what I do:
Start the Server:
call ConnectToPort(uPortNumber);
call StartAccept();
Shutdown the Server:
call SetShutDownFlag(TRUE);
wait until GetNumConections() returns 0; (with a time-out error trap)
call StopAccept();
When I try to re-start the Server, I get normal returns from ConnectToPort() and StartAccept(), but client connections are not accepted.
Any ideas to help me over this hurdle?
Steve
|
|
|
|

|
If you're using the FTPServer as a member class, you could try newing a pointer each time instead - that should reset things.
Do the subsequent connect attempts get as far as CUT_FTPThread::OnConnect()? Stepping through there might be useful.
|
|
|
|

|
Found It!!!!!
BTW, I'm using the 'plain' TCP/IP server functionality--no FTP, SMTP, HTTP, etc. Basically, it'a a custom server for an application that we have.
I don't know if I was stopping my server functions correctly, but after stepping through the code many many times, I finally found that after the server was started the first time and stopped, the m_bShutDown flag was still TRUE! So, naturally, the next time I tried to start the Server, it saw the flag being TRUE and immediately exited!
I've 'fixed' this by adding a GuydonServer.SetShutDownFlag(FALSE); at the end of my ShutDown function, after all the threads have exited, and I've called StopAccept(). This seems to be working much better for me.
|
|
|
|

|
Are there any plans to support IPv6?
|
|
|
|

|
Not from us - but we'd love to have someone in the community update the code.
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|

|
I note that one can retrieve the "name of the attachment" via the second parameter of CUT_Msg::GetAttachmentInfo().
How does one set the "name of the attachment" via the Tcp-Ip library?
Your sage advice is much welcomed.
modified on Wednesday, July 6, 2011 4:39 AM
|
|
|
|

|
I have discovered the 'name' parameter in CUT_Msg::AddAttachment() becomes available as the 'buf' parameter in CUT_Msg::GetAttachmentInfo().
I have also discovered the 2nd AddString in CUT_Msg::AddAttachment() becomes available as the 'type' parameter in CUT_Msg::GetAttachmentInfo().
|
|
|
|

|
I create an array of binary data that contains some NULL values that is > 6000 bytes long. I use CBase64::EncodeData to create an encoded BYTE array. I create a message via the sequence CUT_Msg::SetMessage() using the encoded BYTE array as the source and then use CUT_SMTP::SendMail() to send the BYTE array into the either.
As an aside, I notice deep down in SendMail, the helper function ProcessMail breaks the BYTE array into meaningful chunks by inserting CR LF pairs into the outbound BYTE stream when sent to the server.
Sometime later I receive the BYTE stream from the server via the sequence:
CUTPOP3Client::GetMsgSize()
CUT_MapFileDataSource
CUT_POP3Client::SaveMsg()
This sequence saves the message into a tmp file. This tmp file has embedded CR LF pairs in it already.
I then use the following sequence to acquire the BYTE stream itself:
CUT_MapFileDataSource
CUT_Msg::LoadMessage
CUT_Msg::GetMessageBody
I find the BYTE stream returned by GetMessageBody littered with these CR LF pairs. How do I rid myself of these offending characters? I would have thought there is a parameter I am not setting to prevent these extra characters appearing in my incoming BYTE stream. It seems strange to me that the BYTE array retrieved by GetMessageBody() is not identical to the BYTE array one sends out via SetMessage().
Your sage advice is much welcomed.
modified on Monday, July 4, 2011 12:13 PM
|
|
|
|

|
Not sure I get this. Base64 will break things up into lines of 64 chars, usually delimited by a cr/lf. Mime using Base64 has a max line length of 76 chars, again will usually use cr/lf.
Is something in the code is doubling up on these? Can you post a small message sample of the differences you see?
|
|
|
|

|
I have expanded the question slightly. Does it make more sense?
|
|
|
|

|
I have changed my approach to solving this problem.
This thread is no longer relevant.
|
|
|
|

|
How does one set the priority of a message?
Thanks for your assistance on all my questions.
|
|
|
|

|
Use the message class to AddHeaderField with an ID of UTM_CUSTOM_FIELD - you'll want to end up with a header line something like:
X-Priority: 1 (Highest)
|
|
|
|
|

|
I do not understand the care of SSL certificates. Please help me.
I am trying to connect to a vanilla "free" email provider that requires SSL authentication.
I execute the following code fragment:
CUT_SMTPClient()
SetSecurityEnabled(TRUE)
SetUserName()
SetPassword()
EnableSMTPLogin(TRUE)
SetPort()
SMTPConnect()
Inside the call to SMTPConnect() I get the following message “The certificate's CN name does not match the passed value.”
What does this message mean? and how do I get around it?
modified on Friday, June 17, 2011 10:51 AM
|
|
|
|

|
Maybe I can test if you let me know the provider?
Remember that in Debug you'll sometimes get messages from HandleSecurityError in the UTSecureLayer.dll that aren't necessarily stoppers as the code retries a different connect strategy.
|
|
|
|

|
The providers are vfemail.com, clovermail.com, gmail.com to name a few.
Thanks for your help on this!
|
|
|
|

|
Gmail should definitely work on one of port 587 or 465 (I think 587) - try the secure sample, which should work, then check the code in the IDC_SENDMAIL case of the SMTPDlgProc in test.cpp.
|
|
|
|

|
Can anyone direct me to an example where one may determine how to implement Secure Password Authentication for both POP3 and SMTP using the UT procedures?
|
|
|
|
|

|
I have created an MFC implementation of the ..\Security\Examples\Client\Mail demo program in VC6. The project is located in a directory under the Client directory at the same level as the Mail directory. I can not get rid of the warnings that occur when compiling pop3_c.cpp! These warnings are related to a macro expansion in xlocnum.h. I get these warnings when compiling under Project->Settings->C/C++->Code Generation, Use run-time library is Debug MultiThreaded DLL. I can switch projects to the “original” C++ Mail demo project and pop3_c.cpp compiles with same warnings. What do I need to set in the MFC project and/or the "original" Mail project to resolve the warnings? Both projects create programs that execute correctly, I am curious about the warnings.
modified on Wednesday, June 15, 2011 8:16 AM
|
|
|
|

|
Seems ok here - VC6, XP SP3, PSDK Feb 2003, warning level 4.
Are you using a third party STL implementation? What warnings do you get?
Also, just a double check - make sure you have the updates at The Ultimate Toolbox - Updates and User Contributions[^] - there are important tweaks to the mail source and the secure mail client.
|
|
|
|

|
I have checked and all the UT updates have been applied. Running default MSC STL implementation. The difference between your system and mine is that I am running VC6 sp6 Win2000 sp4, PSDK Feb 2003. The test demo is compiled at level 4 warnings and generates warnings only on Debug Multithreaded DLL, not on Debug Single Threaded or Debug Multithreaded. The demo executes but the warnings are a concern.
|
|
|
|

|
I think with the MFC libs drawn in there might be a subtle issue with the ATL string stuff wrt the stl string implementation.
Try commenting out the <string> include in pop3_c.h?
|
|
|
|

|
Commenting out the "#include in pop3_c.h worked very well. The Mail example in the demo directory compiles without warnings. Can you provide the #ifdefs that go around this include so this patch may go into the code base?
Thank you very much for the solution!
|
|
|
|

|
You could probably wrap that in an #ifndef _AFXDLL - would have to test to see if an extra _MSC_VER check would be appropriate.
|
|
|
|

|
I am trying to build the MailClientS project using VC7. I created a blank solution and added the MailClientS and UTSecureLayer projects and allowed VC to convert them from VC6 to VC7. I first tried to build the UTSecureLayer project in order to generate the related lib file, but it will not build. It fails with the following:
error C2371: 'LONG' : redefinition; different basic types.
Any ideas?
I have already applied Tollbox updates 1, 2 and 3.
|
|
|
|

|
Possibly something to do with the precedence given the Platform SDK include directory in the options settings?
|
|
|
|

|
I moved that include to the top of the list with no change. Are there any specific configurations I should check after having to convert from VS6 to VS7? Maybe a VS7 library or header file I should be ignoring in the configuration while including a VS6 version?
|
|
|
|

|
could it have something to do with this:
UTSecureLayer.DLL builds:
With version 4.2, the UTSecureLayer builds have been renamed based on character set and release/debug version.
Where previously code built against the secure DLL had to assume that the build was compatible with the current settings, we've separated it into UTSecureLayer.DLL, UTSecureLayerU.DLL, UTSecureLayerD.DLL, UTSecureLayerUD.DLL based on Unicode / Debug settings. Some project settings may need to be reset to reflect this.
|
|
|
|

|
There's a stdutfx.h file in the include dir that has:
#if _MSC_VER < 1400
#define ULONG_PTR LONG
#define LONG_PTR LONG
#endif
Might be something odd there.
|
|
|
|

|
Hi!
I've downloaded Ultimate TCP/IP 4.2 and it didn't build for x64 platform on Windows Vista.
There are some unresolved defines since some of them are obsoluted in Platform SDK headers for Vista and higher Windows versions.
Also there are few other minor issues that prevetns successful build.
I have fix for this.
How and to whom should I upload (show fore review) my changes?
Thanks.
|
|
|
|
|

|
I'm having a devil of a time getting my Go Daddy SSL certificate to work. AcquireCredentialsHandle fails consistently with the error "No credentials are available in the security package." This is a Windows 7 (x64) machine but I have the same problem with XP Pro.
|
|
|
|

|
Not sure what part of the toolkit you're using - I did some testing on the ftp client a little while ago just to familiarize myself with the basics and found some oddities - might be in spec of certificate store and/or subject?
Any clues in this thread[^]?
|
|
|
|

|
Thanks Tim. The problem was the incomplete installation of the SLL certificate. It would be nice if the errors were a little clearer. Oh well, another lesson learned.
|
|
|
|

|
I've got my Borland C patch working, so now I'm working on the meat of the patch.
Our old (which is giving us problems in Win7) TCP/IP library allowed the main program to send strings/data to an arbritrary connected client...not from inside each client thread.
As an example, the library would set up an array of connectd clients (0,1,2,etc) and we could send data to any individual client (or all in a simple loop).
I think I've figured out how I can set this up on my own using the Ultimate TCP/IP, but if that ability's already in there (I haven't found it yet), that'd save me some work/debugging.
Any ideas?
|
|
|
|

|
Hi,
I want to connect to gmail's smtp behind a firewall. Is there a way to do that ? (i have my proxy settings)
Thanks !
modified on Tuesday, May 3, 2011 2:39 AM
|
|
|
|

|
I think you should just be able to add a port exception (465 or 587) to the firewall settings. I might be missing something re the proxy in your question.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
Ultimate TCP-IP is now Open Source
| Type | Article |
| Licence | CPOL |
| First Posted | 24 Aug 2007 |
| Views | 922,335 |
| Downloads | 22,625 |
| Bookmarked | 211 times |
|
|