Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 28-02-2009
Member
 
Join Date: Dec 2008
Posts: 29
C++ Builder

hi,
i want to know how to manage the socket on C++ BuilderClient/server with TClientSocket and TServerSocket and How Manages the OnClientRead events and the method for sends text.
Reply With Quote
  #2  
Old 28-02-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: C++ Builder

One Starts with the Server application:
To start your C++ Builder (I have the version 2007)
To create a new “Receiving” project

In the pallet component to add one
TEdit
TButton “the Caption title is Fermer”
TServerSocket

Double Clicks on the window

void __fastcall TForm1:: FormCreate (TObject *Sender)

{

ServerSocket1->Port = 23;

ServerSocket1->Active = True;

}

//--

On the events of the mitre Objet Inspector, double clicks on the case of OnClose and put this code:


//---------------------------------------------------------------------------

void __fastcall TForm1:: FormClose (TObject *Sender, TCloseAction &Action)

{

ServerSocket1->Active = False;

}

//------


On the Card (Form1) click on ServerSocket1 control


On the events of the mitre Objet inspector, double clicks on the case of OnClientRead


Put this code:


void __fastcall TForm1:: ServerSocket1ClientRead (TObject *Sender,

TCustomWinSocket *Socket)

{

Edit1->Clear ();

Edit1->Text = Socket->ReceiveText ();

}

//-

To record the project


Maintaining the Customer:
To create a new project “Waiter”
To add TButton of the caption: Send (sent)
To add ClientSocket
And TEdit

Double clicks on the window and to add this code:

void __fastcall TForm1:: FormCreate (TObject *Sender)

{

ClientSocket1->Port = 23;

ClientSocket1->Host = “Address IP HERE”;

ClientSocket1->Active = True;

}

//-


And In OnClose add this code:


//---------------------------------------------------------------------------

void __fastcall TForm1:: FormClose (TObject *Sender, TCloseAction &Action)

{

ClientSocket1->Active = False;

}

//-

On the card To click twice on the short prop “Send”

Add this code:


void __fastcall TForm1:: Button1Click (TObject *Sender)

{

yew (ClientSocket1->Active)

ClientSocket1->Socket->SendText (Edit1->Text);

}

//-

Recorded the project and carried out it.
Reply With Quote
  #3  
Old 28-02-2009
Member
 
Join Date: Dec 2008
Posts: 29
Re: C++ Builder

hi,
Thank you, for instruction......
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "C++ Builder"
Thread Thread Starter Forum Replies Last Post
what is MSI Package Builder Sparrow Windows Software 3 02-09-2010 06:38 PM
Need a Html web builder Nipissing Software Development 6 12-05-2010 09:28 AM
Builder problem in java Solaris Software Development 3 03-12-2009 02:41 PM
How to become a system builder ? Beltran Education Career and Job Discussions 3 27-06-2009 09:05 AM
SQL Query Builder LasitMalinga Software Development 5 29-04-2009 03:15 PM


All times are GMT +5.5. The time now is 08:54 AM.