My_UdpSocket1. LocalPort
My_UdpSocket1. LocalHostAddr
Can't get a null value,
CodePudding user response:
Up a little, waiting for the master,CodePudding user response:
Delphi section in cold and cheerlessCodePudding user response:
Delphi is terrible,CodePudding user response:
Master really rarely now, ha haCodePudding user response:
The function Sckt_GetLocalIP: string;Type
TarrPInAddr=array [0.. 10] of PInAddr;
ParrPInAddr=^ TarrPInAddr;
Var
PHost: PHostEnt;
P: ParrPInAddr;
Buf: an array of Char [0.. 63];
I: Integer;
The begin
Result:=';
If gethostname (buf, SizeOf (buf))=0 then
The begin
PHost:=gethostbyname (buf);
If pHost=nil then
The Exit;
P:=ParrPInAddr (pHost ^. H_addr_list);
I:=0;
While p ^ [I] <> Nil do//to take the last one is the local IP
The begin
Result:=inet_ntoa (p ^ ^ [I]);
Inc (I);
end;
end;
end;
WSAStartup (WINSOCK_VERSION, WSAData);
WSACleanup
CodePudding user response:
LocalPort?RemotePort or PeerPort