本文整理汇总了C++中Display::Exeception方法的典型用法代码示例。如果您正苦于以下问题:C++ Display::Exeception方法的具体用法?C++ Display::Exeception怎么用?C++ Display::Exeception使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display
的用法示例。
在下文中一共展示了Display::Exeception方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
Display *disp = new Display();
title("Server", '=');
try
{
string client_port;
if (argc > 1)
{
client_port = argv[1];
}
int clientport=atoi(client_port.c_str());
Verbose v(true);
SocketSystem ss;
SocketListener sl(clientport,Socket::IP6);
ClientHandler cp;
sl.start(cp);
Verbose::show("press key to exit: ", always);
std::cout.flush();
std::cin.get();
}
catch (std::exception& ex)
{
disp->Exeception(ex);
}
}
示例2: writeToFile
// Writes to the file in the server..
string Receiver::writeToFile(std::string filemsg, bool type,Socket &si)
{
Display *disp = new Display();
Message *m = new Message();
char filestart = m->getFileStart(filemsg);
string filename = m->getFileName(filemsg),fullpath= "../UploadedFolder/" + filename,msgbody = m->getmsgBody(filemsg),msgstr="";
std::ofstream o;
try
{
if (type == true)
{
if (filestart == '1')
{
o.open(fullpath);
o << msgbody << endl;
}
else if (filemsg.find("Body:endfile") != string::npos)
{
o.close();
string uploadpath = "../UploadedFolder/" + m->getFileName(filemsg);
disp->show("\n**************************************************\n");
disp->show("Requirement 1\n");
string uploadstring = "Recieved File: " + m->getFileName(filemsg)+" And stored at path: " +uploadpath;
disp->show(uploadstring);
string pmsg = "Sending Acknowledgement to Client with address: " + m->getsendAddr(filemsg);
disp->show(pmsg);
disp->show("\n**************************************************\n");
msgstr = setMessage(filemsg);
}
else
{
o.open(fullpath,ios::app);
if (o.is_open())
o << msgbody << endl;
}
}
return msgstr;
}
catch (exception ex)
{
disp->Exeception(ex);
return "";
}
}
示例3: start
// Starts the receiver
string Receiver::start(string msg1,Socket &si)
{
try
{
Message *msgobj = new Message();
msgobj->setMessage(msg1);
string msgstr="";
if (msg1.find("command:uploadfile") != std::string::npos)
msgstr=writeToFile(msg1, type,si);
if (msg1.find("command:download") != std::string::npos)
msgstr=downloadMessage(msg1, msgobj,si);
else if (msg1.find("command:filesearch") != std::string::npos)
msgstr = filesearchMessage(msg1, msgobj, si);
else if (msg1.find("command:textsearch") != std::string::npos)
{
string result = "";
result = performTextSearch(msg1, result);
msgstr = result;
//si.sendString(result);
}
else if (msg1.find("command:retrieve_categories") != std::string::npos)
{
string result = "";
result=performRetrieveCategories(msg1,result);
msgstr = result;
//si.sendString(result);
}
else if (msg1.find("command:retrieve_files") != std::string::npos)
{
string result = "";
result = performRetrieveFiles(msg1, result);
msgstr = result;
//si.sendString(result);
}
return msgstr;
}
catch (std::exception& ex)
{
Display *disp = new Display();
disp->Exeception(ex);
return "";
}
}