mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-24 18:22:25 -05:00
Simba: Added procedure SocketInfo.
This commit is contained in:
parent
d75f7d55cf
commit
c6c43d00c1
@ -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();
|
||||
|
@ -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 }
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user