Forum > Portuguese
Problemas com o INDY 10
Emerson:
Boa tarde!
Estou criando um socket server e um client usando o INDY 10 mais estou com o seguinte problema:
No Windows funciona perfeitamente ao ativar o componente TCPServer, mais na compilação no Linux Mint, ocorre o seguinte error no momento de ativar o componente:
"Projeto SockServer elevou classe exceção 'RunError(232)'."
No endereço EBDEBC
Alguém já pegou este problema ou sabe como resolver?
Gustavo 'Gus' Carreno:
Oies Emerson, boas,
--- Quote from: Emerson on March 24, 2021, 04:56:20 pm ---Alguém já pegou este problema ou sabe como resolver?
--- End quote ---
A primeira coisa que me ocorre é um problema com SSL. No Linux Mint, como estão as libs do OpenSLL?
Outra seria verificar se a versão do Indy é a mesma no Windows e no Linux Mint.
Se tudo isto checar, estou perdido. Talvez um bocado do código seria bom?
Abraço,
Gus
Remy Lebeau:
--- Quote from: Emerson on March 24, 2021, 04:56:20 pm ---"Projeto SockServer elevou classe exceção 'RunError(232)'."
--- End quote ---
(Sorry, I don't speak Portuguese)
According to this post:
https://forum.lazarus.freepascal.org/index.php/topic,7017.msg32949.html#msg32949
--- Quote ---Run time error 232 means that the threading supppoort is not enabled. It seems that the package that installs TIdIPWatch does not define -dUseCThreads in its usage options.
--- End quote ---
This is also documented:
http://www.freepascal.org/docs-html/user/userap4.html#x194-193000D
--- Quote ---232 Threads not supported
Thread management relies on a separate driver on some operating systems (notably, Unixes). The unit with this driver needs to be specified on the uses clause of the program, preferably as the first unit (cthreads on unix).
--- End quote ---
So, in your project's main source, try adding this:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses {$IFDEF UNIX} cthreads, {$ENDIF} ...;
Emerson:
Olá pessoal!
Eu conferi todas informações:
1 - Lib SSL, ok
2 - {$IFDEF UNIX}
cthreads,
{$ENDIF} ok
3 - Versão do Indy do Windows e do Linux foram instaladas diretamente do repositório online do Lazarus ambos na mesma versão, ok
Mesmo com estes teste, ainda não funcionou.
unit TelaSockServer;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
IdTCPServer, IdCustomTCPServer, IdContext;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
IdTCPServer1: TIdTCPServer;
procedure Button1Click(Sender: TObject);
procedure IdTCPServer1Execute(AContext: TIdContext);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var
v_comando_recebido: String;
v_mensagem : string;
begin
v_comando_recebido := AContext.Connection.Socket.ReadLn;
v_mensagem := 'Certifico o recebimento do comando: ' + v_comando_recebido;
AContext.Connection.Socket.WriteLn(v_mensagem);
AContext.Connection.Disconnect;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if IdTCPServer1.Active then
begin
IdTCPServer1.Active := false;
end else
begin
IdTCPServer1.Active := true;
end;
end;
end.
O meu código é bem simples. Defini no componente a porta 8080 e tentei ativar, mais sem sucesso!
O que será que estou fazendo de errado?
Remy Lebeau:
Are you still getting the same runtime error 232? Or are you having a different problem now? If so, what exactly? The code you have provided looks fine mostly, although I don't see the cthreads unit in the uses clause.
Navigation
[0] Message Index
[#] Next page