예제 #1
0
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
0
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
0
파일: 1.cpp 프로젝트: codeserfer/7-term
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();
	}
}