procedure TForm1.FormCreate(Sender: TObject); begin StartupSocket(); FConnection := TclTcpServerConnection.Create(); end; procedure TForm1.FormDestroy(Sender: TObject); begin FConnection.Free(); CleanupSocket(); end;
procedure TForm1.btnListenClick(Sender: TObject); var data: TStream; begin try FConnection.NetworkStream := TclNetworkStream.Create(); FConnection.Listen(StrToInt(edtPort.Text)); memLog.Lines.Add('=== Start listening ==='); FStarted := True; FConnection.TimeOut := -1; FConnection.Accept(); data := TMemoryStream.Create(); try repeat FConnection.ReadData(data); memLog.Lines.Add('Received bytes: ' + IntToStr(data.Size)); Application.ProcessMessages(); data.Size := 0; until not FConnection.Active; finally data.Free(); end; except on E: EclSocketError do begin if ((E.ErrorCode <> 10053) and (E.ErrorCode <> 10038)) then raise; end; end; end;
Trouble logging in? Simply enter your email address OR username in order to reset your password.
For faster and more reliable delivery, add admin@clevercomponents.com to your trusted senders list in your email software.