git-svn-id: svn://ultimatepp.org/upp/trunk@6659 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-12-16 13:15:28 +00:00
parent 6986e7917f
commit 01613e65fb
3 changed files with 46 additions and 0 deletions

31
upptst/Socket/Socket.cpp Normal file
View file

@ -0,0 +1,31 @@
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_COUT|LOG_FILE);
TcpSocket socket;
if(!socket.Connect("pop.gmail.com", 995)) {
LOG("Socket error encountered: " << socket.GetErrorDesc());
Exit(1);
}
if(!socket.StartSSL()) {
LOG("Couldn't start SSL session.");
Exit(1);
}
// 5 secs.
socket.Timeout(5000);
String server_hello = socket.GetLine();
DUMP(server_hello);
DUMPHEX(server_hello);
ASSERT(server_hello.StartsWith("+OK Gpop ready for requests from"));
LOG("=========== OK");
}

10
upptst/Socket/Socket.upp Normal file
View file

@ -0,0 +1,10 @@
uses
Core,
Core/SSL;
file
Socket.cpp;
mainconfig
"" = "SSE2";

5
upptst/Socket/init Normal file
View file

@ -0,0 +1,5 @@
#ifndef _Socket_icpp_init_stub
#define _Socket_icpp_init_stub
#include "Core/init"
#include "Core/SSL/init"
#endif