在indy9中,IdTCPServer能否快速得到对方计算机名?

zhgwbzhd 2010-09-20 12:26:48

AThread->Connection->Socket->Binding->PeerIP
可以得到对方的IP。

indy是否提供了可以获得计算机名的或者网卡MAC的方法??

我不想再用getnameinfo的方法来获得计算机名。
谢谢各位!
...全文
151 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jone7319 2010-09-21
  • 打赏
  • 举报
回复
目的达到就可以了
zhgwbzhd 2010-09-20
  • 打赏
  • 举报
回复
用它还要先 socket(...)。我觉得也不是太理想。

我想用 indy的话,他肯定也会有对应的socket.通过他的某个函数直接就可以获得呢??
我不懂电脑 2010-09-20
  • 打赏
  • 举报
回复
The Windows Sockets getpeername function gets the address of the peer to which a socket is connected.

int getpeername (

SOCKET s,
struct sockaddr FAR* name,
int FAR* namelen
);


Parameters

s

[in] A descriptor identifying a connected socket.

name

[out] The structure which is to receive the name of the peer.

namelen

[out] A pointer to the size of the name structure.



Remarks

getpeername retrieves the name of the peer connected to the socket s and stores it in the struct sockaddr identified by name. It can be used only on a connected socket. For datagram sockets, only the name of a peer specified in a previous connect call will be returned綼ny name specified by a previous sendto call will not be returned by getpeername.
On return, the namelen argument contains the actual size of the name returned in bytes.

Return Values

If no error occurs, getpeername returns zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.

Error Codes

WSANOTINITIALISED A successful WSAStartup must occur before using this function.
WSAENETDOWN The network subsystem has failed.
WSAEFAULT The name or the namelen argument is not a valid part of the user address space, or the namelen argument is too small.
WSAEINPROGRESS A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.
WSAENOTCONN The socket is not connected.
WSAENOTSOCK The descriptor is not a socket.


See Also

bind, getsockname, socket
内容概要:本文系统研究了并网虚拟同步发电机(VSG)的自适应惯量阻尼调控策略及其对频率动态响应稳定性的影响,聚焦于VSG在并网工况下的惯量与阻尼协同自适应控制机制。通过构建Simulink仿真模型并结合Matlab代码实现,深入分析VSG的动态特性、有功/无功功率响应及电网频率稳定性,采用根轨迹法评估不同调节系数对系统稳定性的敏感性,揭示其支撑电网频率稳定的能力。研究进一步拓展至微电网黑启动、预同步控制、虚拟阻抗技术以及双机VSG间的功率精确分配等关键应用场景,旨在应对高比例新能源接入带来的系统惯量下降与频率稳定挑战,提升电力系统的韧性与可靠运行水平。; 适合人群:具备电力系统分析、自动控制理论及新能源并网技术背景,熟练掌握Matlab/Simulink仿真工具,从事电气工程、能源互联网、微电网控制等相关领域的研究生、科研人员及工程技术人员。; 使用场景及目标:①深入探究VSG在并网模式下惯量与阻尼参数的自适应协同调控原理与实现方法;②系统分析VSG控制策略对电网频率动态响应过程的影响规律与稳定边界;③通过仿真实践掌握VSG关键控制参数(如虚拟惯量、阻尼系数)的设计、整定及其对系统性能影响的量化评估;④为微电网的自主黑启动、无缝并网及高渗透率可再生能源系统的频率稳定控制提供先进的技术方案与决策依据。; 阅读建议:建议读者结合文提供的完整Matlab代码与Simulink模型进行动手仿真实验,重点关注控制策略的模块化设计逻辑、参数动态调整过程与系统整体性能之间的关联,务必结合电力系统小信号稳定性分析理论,深入理解根轨迹、特征值等分析结果所蕴含的物理意义,从而实现从理论到实践的贯通。

1,317

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 网络及通讯开发
社区管理员
  • 网络及通讯开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧