diff --git a/Units/MMLAddon/PSInc/Wrappers/internets.inc b/Units/MMLAddon/PSInc/Wrappers/internets.inc index 3b97ea0..80dbb05 100644 --- a/Units/MMLAddon/PSInc/Wrappers/internets.inc +++ b/Units/MMLAddon/PSInc/Wrappers/internets.inc @@ -107,6 +107,11 @@ begin Result := CurrThread.Socks.CreateSocketEx(CurrThread.Socks.GetSocket(Client).Accept); end; +procedure ps_SocketInfo(Client: integer; out IP, Port: string); +begin + CurrThread.Socks.GetSocket(Client).Info(IP, Port); +end; + function ps_CreateSocket: integer; extdecl; begin Result := CurrThread.Socks.CreateSocket(); diff --git a/Units/MMLAddon/PSInc/psexportedmethods.inc b/Units/MMLAddon/PSInc/psexportedmethods.inc index 4c109c7..123d759 100644 --- a/Units/MMLAddon/PSInc/psexportedmethods.inc +++ b/Units/MMLAddon/PSInc/psexportedmethods.inc @@ -280,6 +280,7 @@ AddFunction(@ps_RecvSocketStr, 'function RecvSocketStr(Client: integer): string; AddFunction(@ps_RecvSocketEx, 'function RecvSocketEx(Client, Length: integer): string;'); AddFunction(@ps_SendSocket, 'procedure SendSocket(Client: integer; Data: string);'); AddFunction(@ps_SetSocketTimeout, 'procedure SetTimeout(Client, Time: integer);'); +AddFunction(@ps_SocketInfo, 'procedure SocketInfo(Client: integer; out IP, Port: string);'); {$ENDIF} { Color Conversions and Speed } diff --git a/Units/MMLAddon/internets.pas b/Units/MMLAddon/internets.pas index 7cfd1d6..8db882f 100644 --- a/Units/MMLAddon/internets.pas +++ b/Units/MMLAddon/internets.pas @@ -64,6 +64,7 @@ type procedure Bind(IP, Port: string); procedure Listen; function Accept: TTCPBlockSocket; + procedure Info(out IP, Port: string); constructor Create(Owner: TObject; Socket: TTCPBlockSocket = nil); destructor Destroy; override; end; @@ -420,6 +421,12 @@ begin raise Exception.Create('Socket Error ' + IntToStr(Sock.LastError) + ': ' + Sock.LastErrorDesc); end; +procedure TSock.Info(out IP, Port: string); +begin + IP := Sock.GetRemoteSinIP; + Port := IntToStr(Sock.GetRemoteSinPort); +end; + constructor TSock.Create(Owner: TObject; Socket: TTCPBlockSocket = nil); begin inherited Create;