Ver Mensaje Individual
  #5  
Antiguo 02-10-2015
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola c64.

No especificas que componente están usando y en el video no pude apreciar cual es. Pero, como para darte una idea, te pongo un ejemplo muy simple de como enviar y recibir unos datos con los componentes TClientSocket y TServerSocket. Básicamente no puede ser muy diferente a lo que tienen que hacer.

Receptor (server):
Código PHP:
struct {
  
int a;
  
int b;
  
int c;
} 
data;

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  
ServerSocket1->Port = 23; // Puerto
  
ServerSocket1->Open();
}

void __fastcall TForm1::ServerSocket1ClientRead(TObject *Sender,
  
TCustomWinSocket *Socket)
{
  
Socket->ReceiveBuf(&data, sizeof(data));
  
ListBox1->Items->Add(data.a);
  
ListBox1->Items->Add(data.b);
  
ListBox1->Items->Add(data.c);
}

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
  
ServerSocket1->Close();
} 
Emisor (cliente):
Código PHP:
struct {
  
int a;
  
int b;
  
int c;
} 
data;

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  
ClientSocket1->Port =  23;  // Puerto
  
ClientSocket1->Host =  "192.168.0.62"; //IP server
  
ClientSocket1->Open();
}

void __fastcall TForm1::btnSendClick(TObject *Sender)
{
  
// valores a enviar
  
data.a = 1111;
  
data.b = 2222;
  
data.c = 3333;

  if (
ClientSocket1->Active)
    
ClientSocket1->Socket->SendBuf(&data, sizeof(data));
}

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
  
ClientSocket1->Close();
} 
Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 02-10-2015 a las 22:34:31.
Responder Con Cita