本文整理汇总了C++中TCP::ReceiveData方法的典型用法代码示例。如果您正苦于以下问题:C++ TCP::ReceiveData方法的具体用法?C++ TCP::ReceiveData怎么用?C++ TCP::ReceiveData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCP
的用法示例。
在下文中一共展示了TCP::ReceiveData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
TCP* tcp = new TCP();
try
{
char chain[2104];
string separtor = "";
cout << "Input a chain of a numbers separated by spaces: ";
cin.getline(chain, sizeof(chain));
cout << "Input a separator: ";
cin >> separtor;
Send(tcp, chain);
Send(tcp, separtor, false);
cout << "Reseive: " << endl;
cout << tcp->ReceiveData() << endl;
tcp->CloseConnection();
}
catch (string error)
{
cout << error;
tcp->CloseConnection();
}
}
示例2: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
TCP* tcp = new TCP();
try
{
tcp->Startup();
tcp->InitSocket();
tcp->Connect(PORT, HOST);
cout << "Input string to send: ";
string s;
cin >> s;
tcp->SendData(s);
cout << "Reseive: " << endl;
cout << tcp->ReceiveData() << endl;
tcp->CloseConnection();
}
catch (string error)
{
cout << error;
tcp->CloseConnection();
}
}
示例3: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
TCP* tcp = new TCP();
try
{
tcp->Startup();
tcp->InitSocket();
tcp->Connect(PORT, HOST);
tcp->SendData("HELO domain.local\r\n");
cout << "Reseive: " << endl;
cout << tcp->ReceiveData() << endl;
tcp->SendData("MAIL FROM:<stud_08>\r\n");
cout << "Reseive: " << endl;
cout << tcp->ReceiveData() << endl;
tcp->SendData("RCPT TO:<stud_07>\r\n");
cout << "Reseive: " << endl;
cout << tcp->ReceiveData() << endl;
tcp->SendData("DATA\r\n");
cout << "Reseive: " << endl;
cout << tcp->ReceiveData() << endl;
tcp->SendData("I want to sleep!\r\n.\r\n");
cout << "Reseive: " << endl;
cout << tcp->ReceiveData() << endl;
tcp->SendData("QUIT\r\n");
cout << "Reseive: " << endl;
cout << tcp->ReceiveData() << endl;
tcp->CloseConnection();
}
catch (string error)
{
cout << error;
tcp->CloseConnection();
}
}