
Добавил:
Upload
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:seti_2semestr / Лабораторные работы / ЛР_7 / Samples / UDP / VisualCPP / UDPClient / UDPClient
.cpp// UDPClient.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "UDPClient.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#include "TFTPClient.h"
#include "DNSClient.h"
#include <conio.h>
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if(!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
}
else if(!AfxSocketInit())
{
_tprintf(_T("Fatal Error: Socket initialization failed\n"));
nRetCode = 2;
}
else
{
CDNSClient* Client=new CDNSClient();
Client->SetServer("195.34.224.1");
if(Client->CreateThread())
{
Sleep(1000);
Client->QueryServer("as.stu.lipetsk.ru","A");
}
getch();
Client->PostThreadMessage(WM_QUIT,0,0);
/* CTFTPClient* Client=new CTFTPClient();
Client->SetServer("ftp.lipetsk.ru");
if(Client->CreateThread())
{
Sleep(1000);
Client->GetFile("readme.txt","d:\\Sample.txt");
}
getch();
Client->PostThreadMessage(WM_QUIT,0,0);*/
// Sleep(1000);
// delete Client;
}
return nRetCode;
}
Соседние файлы в папке UDPClient