#include "stdafx.h"
using namespace System;
using namespace System::IO;
using namespace System::Net;
using namespace System::Net::Sockets;
void main()
{
TcpClient^ server;
StreamWriter^ writer;
StreamReader^ reader;
String^ msg;
server = gcnew TcpClient("127.0.0.1", 12345);
writer = gcnew StreamWriter(server->GetStream());
reader = gcnew StreamReader(server->GetStream());
msg = "msg";
writer->WriteLine(msg);
writer->Flush();
msg = reader->ReadLine();
Console::WriteLine(msg);
Console::WriteLine("Ended connection with server.");
server->Close();
}
|