#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include <SysUtils.hpp>
#pragma package(smart_init)
#pragma resource "*.dfm"
#define ListeningMsg L
TForm1 *Form1;
AnsiString Server;
bool IsServer = False;
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//Connect
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (ClientSocket1->Active)
{
ClientSocket1->Active = false;
ClientSocket2->Active = false;
}
if (InputQuery("Ââåäèòå èìÿ èëè èï", "àäðåñ:", Server))
{
if (Server.Length() > 0)
{
ClientSocket1->Host = Server;
ClientSocket1->Active = true;
ClientSocket2->Host = Server;
ClientSocket2->Active = true;
FileListen1->Checked = false;
}
}
}
void __fastcall TForm1::ServerSocket1Listen(TObject *Sender,
TCustomWinSocket *Socket)
{
FileListen1->Checked = !FileListen1->Checked;
if (FileListen1->Checked)
{
ClientSocket1->Active = false;
ServerSocket1->Active = true;
ClientSocket2->Active = false;
ServerSocket2->Active = true;
StatusBar1->SimpleText = ListeningMsg;
}
else
{
if (ServerSocket1->Active)
{
ServerSocket1->Active = false; ServerSocket2->Active = false; } StatusBar1->SimpleText = "";
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
FileListen1Click(NULL);
}
Аналог net send на C++
вот что то тут накатал
Код:
Дальше полный ступор.
Пожалуйста напишите хотябы словами алгоритм КАК это должно происходить.