views:

118

answers:

1

1.Client

procedure TForm1.ButtonKoneksiClick(Sender: TObject);
begin
  if ClientSocket1.Active then
    begin
      ClientSocket1.Active := false;
    end
  else
    begin
      ClientSocket1.Address := EditIPServer.Text;
      ClientSocket1.Port    := StrToInt(EditPortServer.Text);
      ClientSocket1.Active  := true;
    end;
end;
+1  A: 

It's a code which connects to a server in a given port or disconnects depending if the socket is already connected or not.

First, discover which class in Java allow bare socket connections. Create 2 methods (Connect and Disconnect) and put it in another Button (or the equivalent int AWT and/or Swing) testing if the object is connected or not.

But, like Mason said in the comment, I won't do the homework for you. Try and, if gives error, post your attempts here.

Fabricio Araujo