Delphi 2010 - 套接字端口 119 不起作用

发布于 2024-10-21 18:38:50 字数 367 浏览 8 评论 0原文

我正在端口 119 上打开一个套接字(使用 idHttpServer),它打开正常(没有报告错误,我可以通过查看 netstat 看到端口 119 已打开)。但是当我的套接字客户端向服务器119端口发送请求时,服务器没有收到请求,客户端也无法工作。如果我将套接字端口更改为另一个端口(例如 90、80、120),它就可以正常工作。
我猜想套接字端口 119 是一个 SO 保留端口(但该端口上没有任何运行,我确信这一点)。我还知道新闻协议使用端口 119(但没有新闻服务器)。
有谁知道为什么我无法连接到 119 端口? 110 端口也会发生同样的情况(pop,但 pop 服务器未打开)。这让我发疯。

德尔福2010
最新独立版本
Windows 2003服务器企业版。

I am opening a socket on port 119 (using idHttpServer) and it opens ok (no errors reported and i can see that the port 119 is opened by looking at netstat). But when my socket client sends a request to the server 119 port, the server does not get the request neither the client works. If i change the socket port to another one (such as 90, 80, 120) it works fine.
I guess that the socket port 119 is a SO reserved port (but theres nothing running on that port, i am sure about that). I also know that port 119 is used by news protocol (but there is no news server).
Does anyone know why i cant connect to the 119 port? The same thing happens with the 110 port (pop, but not pop server on). It is driving me crazy.

Delphi 2010
Latest indy version
Windows 2003 server enterprise edition.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

情仇皆在手 2024-10-28 18:38:50

它应该是您的开发机器中的某个东西,因为将 119 端口(或任何其他可用端口)与 INDY HTTP Server 一起使用是完全有效的。考虑到不建议使用 1024 个保留端口以下的 80 以外的端口,但这是另一回事。

我做了一个简单的测试,两个应用程序。以下是相关部分:

Server

dfm

object Form2: TForm2
  Caption = 'Server'
  object IdHTTPServer1: TIdHTTPServer
    Active = True
    Bindings = <>
    DefaultPort = 119
    Left = 56
    Top = 40
  end
end

Client

dfm

object Form3: TForm3
  Caption = 'Form3'
  object Memo1: TMemo
    Left = 16
    Top = 8
    Width = 185
    Height = 89
    Lines.Strings = (
      'Memo1')
    TabOrder = 0
  end
  object Button1: TButton
    Left = 207
    Top = 8
    Width = 75
    Height = 25
    Caption = 'Connect'
    TabOrder = 1
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 207
    Top = 39
    Width = 75
    Height = 25
    Caption = 'Disconnect'
    TabOrder = 2
    OnClick = Button2Click
  end
  object IdTCPClient1: TIdTCPClient
    OnStatus = IdTCPClient1Status
    ConnectTimeout = 0
    Host = 'localhost'
    IPVersion = Id_IPv4
    Port = 119
    ReadTimeout = -1
    Left = 32
    Top = 40
  end
end

pas

procedure TForm3.Button1Click(Sender: TObject);
begin
  IdTCPClient1.Connect;
end;

procedure TForm3.Button2Click(Sender: TObject);
begin
  IdTCPClient1.Disconnect;
end;

procedure TForm3.IdTCPClient1Status(ASender: TObject; const AStatus: TIdStatus;
  const AStatusText: string);
begin
  Memo1.Lines.Add(AStatusText);
end;

结果:

成功连接

不要忘记允许防火墙上的流量,例如接受默认 Windows 对话框(如果使用 Windows 防火墙):

“防火墙警告”

It shall to be something in your development machine, because it is perfectly valid to use the 119 port (or any other available port) with INDY HTTP Server. Take in account it is not recommended to use ports different than 80 below the 1024 reserved ports to to that, but that's another thing.

I made a simple test, two applications. Here are the relevant parts:

Server

dfm

object Form2: TForm2
  Caption = 'Server'
  object IdHTTPServer1: TIdHTTPServer
    Active = True
    Bindings = <>
    DefaultPort = 119
    Left = 56
    Top = 40
  end
end

Client

dfm

object Form3: TForm3
  Caption = 'Form3'
  object Memo1: TMemo
    Left = 16
    Top = 8
    Width = 185
    Height = 89
    Lines.Strings = (
      'Memo1')
    TabOrder = 0
  end
  object Button1: TButton
    Left = 207
    Top = 8
    Width = 75
    Height = 25
    Caption = 'Connect'
    TabOrder = 1
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 207
    Top = 39
    Width = 75
    Height = 25
    Caption = 'Disconnect'
    TabOrder = 2
    OnClick = Button2Click
  end
  object IdTCPClient1: TIdTCPClient
    OnStatus = IdTCPClient1Status
    ConnectTimeout = 0
    Host = 'localhost'
    IPVersion = Id_IPv4
    Port = 119
    ReadTimeout = -1
    Left = 32
    Top = 40
  end
end

pas

procedure TForm3.Button1Click(Sender: TObject);
begin
  IdTCPClient1.Connect;
end;

procedure TForm3.Button2Click(Sender: TObject);
begin
  IdTCPClient1.Disconnect;
end;

procedure TForm3.IdTCPClient1Status(ASender: TObject; const AStatus: TIdStatus;
  const AStatusText: string);
begin
  Memo1.Lines.Add(AStatusText);
end;

The result:

Successfully connected

Dont forget to allow traffic on the firewall, for example by accepting the default windows dialog (in case of using windows firewall):

Firewall warning

二智少女 2024-10-28 18:38:50

检查119端口是否真的空闲。例如,使用 Sysinternals 的 TcpView。

http://technet.microsoft.com/en-us/sysinternals/bb842062

Check if the port 119 is really free. For example with TcpView from Sysinternals.

http://technet.microsoft.com/en-us/sysinternals/bb842062

淡莣 2024-10-28 18:38:50

由于您在打开/绑定端口时没有收到错误,因此听起来您的服务器端很好,客户端可能会被阻止。
是时候看看客户端的防火墙了......

Since you didn't get an error on open/bind of the port, it sounds like your server-side is just fine, it's the client side that is likely getting blocked.
Time to look at firewall on the client...

在你怀里撒娇 2024-10-28 18:38:50

似乎端口 119 被多个商城软件(Happy99 等)使用。您的防病毒软件可能正在阻止该端口。另外,您是否打开了 Windows 防火墙的端口?只是我的 5 美分...

最诚挚的问候,
拉杜

It seems that port 119 is used by several mallwares(Happy99 and others). Your antivirus maybe is blocking the port. Also, have you opened the port from Windows's Firewall? just my 5 cents...

Best regards,
Radu

蓝天白云 2024-10-28 18:38:50

您确定 NNTPSVC 服务没有运行吗?
http://support.microsoft.com/kb/832017

您还可以使用 Portqry.exe查看端口是否正常工作
http://support.microsoft.com/default.aspx?scid =kb;en-us;310099

关于此主题,我记得的最后一件事是 ISA 有时会阻止此端口。所以你需要确保这种情况不会发生。

哈特哈,

Are you sure NNTPSVC service is not running?
http://support.microsoft.com/kb/832017

You can also use Portqry.exe to see if port is working
http://support.microsoft.com/default.aspx?scid=kb;en-us;310099

Last thing i remember about this topic is that ISA sometimes block this port. So you need assure this is not happening.

HTH,

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文