Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

please get me the following Delphi to Java conversion

Sat Jul 31, 2010 5:26 am

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;

procedure TForm1.ClientSocket1Connecting(Sender: TObject;
Socket: TCustomWinSocket);
begin
LabelStatusKoneksi.Caption := 'Mencoba koneksi ke server';
end;

procedure TForm1.ClientSocket1Connect(Sender: TObject;
Socket: TCustomWinSocket);
begin
LabelStatusKoneksi.Caption := 'Terkoneksi ke server';
ButtonKoneksi.Caption := 'Putuskan Koneksi'
end;

procedure TForm1.ClientSocket1Disconnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
LabelStatusKoneksi.Caption := 'Tidak terkoneksi ke server';
ButtonKoneksi.Caption := 'konek ke server';
end;

procedure TForm1.ClientSocket1Error(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
begin
LabelStatusKoneksi.Caption :=
'Terjadi error saat koneksi ke server';
ErrorCode := 0;
end;

procedure TForm1.ButtonkirimClick(Sender: TObject);
begin
if ClientSocket1.Active then
ClientSocket1.Socket.SendText(EditData.Text)
else
ShowMessage('Koneksi tidak aktif');
end;

end.

2.Server
procedure TForm1.ButtonJalankanClick(Sender: TObject);
begin
if ServerSocket1.Active then
begin
ServerSocket1.Active := false;
LabelStatusServer.Caption := 'Server tidak aktif';
ButtonJalankan.Caption := 'Jalankan server';
end
else
begin
ServerSocket1.Port := StrToInt(EditPortServer.Text);
ServerSocket1.Active := true;
LabelStatusServer.Caption := 'Server aktif mendengarkan klien';
ButtonJalankan.Caption := 'Matikan server';
end;
end;

procedure TForm1.ServerSocket1ClientConnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
LabelKlien.Caption := 'Klien terkoneksi dari'+ Socket.RemoteAddress;
end;

procedure TForm1.ServerSocket1ClientDisconnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
LabelKlien.Caption := 'Tidak ada klien terkoneksi';
end;

procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
begin
Memo1.Lines.Add(Socket.ReceiveText);
end;

end.



Post a reply
  Related Posts  to : please get me the following Delphi to Java conversion
 .dll conversion     -  
 Number Conversion     -  
 Type Conversion     -  
 SUCCESSIVE APPROXIMATION ANALOGUE TO DIGITAL CONVERSION     -  
 conversion from binary to decimal numbers as string     -  
 ramp Counter ANALOGUE TO DIGITAL CONVERSION (ADC)     -  
 2d game in java-Monster-Java 2D Game Graphics and Animation     -  
 what is java     -  
 Using FTP in java     -  
 Java course     -