+ -
当前位置:首页 → 问答吧 → IdUDPClient发送数据,可不可以用目标机的 主机名 代替IP ?

IdUDPClient发送数据,可不可以用目标机的 主机名 代替IP ?

时间:2011-12-20

来源:互联网

IdUDPClient发送数据,可不可以用目标机的 主机名 代替IP ?
现在用的方法是:
IdUDPClient1->Host = "172.16.113.220";
IdUDPClient1->Port = 8080;
IdUDPClient1->Send(s, NULL); //顺便问一下,此处的第二个参数是干嘛用的???
我希望将IP替换成目标机器的主机名(同一局域网下),如“PC_name”,请问如何实现?
谢谢

作者: syrchina   发布时间: 2011-12-20

Host可以是IP,也可以是主机名称
Host is a String property used to identify the address of the remote computer system. Host and Port are used to build the UDP datagram packet, and identify the endpoint for the transmission.
Host can contain an IP address in dotted-decimal form, such as "129.71.2.4", or a computer name, such as "wvnvm.wvnet.edu". If the destination is also the machine where the UDP client is running, use "127.0.0.1" in Host.

作者: ksrsoft   发布时间: 2011-12-20

你这个IdUDPClient是什么版本的,cb6中的没有这个定义啊
procedure Send(AData: string); overload;

作者: ksrsoft   发布时间: 2011-12-20