1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-28 12:02:15 -05:00

Simba: Added procedure SocketInfo.

This commit is contained in:
John P (Dgby714) 2011-01-12 20:17:43 -05:00
parent d75f7d55cf
commit c6c43d00c1
3 changed files with 13 additions and 0 deletions

View File

@ -107,6 +107,11 @@ begin
Result := CurrThread.Socks.CreateSocketEx(CurrThread.Socks.GetSocket(Client).Accept); Result := CurrThread.Socks.CreateSocketEx(CurrThread.Socks.GetSocket(Client).Accept);
end; end;
procedure ps_SocketInfo(Client: integer; out IP, Port: string);
begin
CurrThread.Socks.GetSocket(Client).Info(IP, Port);
end;
function ps_CreateSocket: integer; extdecl; function ps_CreateSocket: integer; extdecl;
begin begin
Result := CurrThread.Socks.CreateSocket(); Result := CurrThread.Socks.CreateSocket();

View File

@ -280,6 +280,7 @@ AddFunction(@ps_RecvSocketStr, 'function RecvSocketStr(Client: integer): string;
AddFunction(@ps_RecvSocketEx, 'function RecvSocketEx(Client, Length: integer): string;'); AddFunction(@ps_RecvSocketEx, 'function RecvSocketEx(Client, Length: integer): string;');
AddFunction(@ps_SendSocket, 'procedure SendSocket(Client: integer; Data: string);'); AddFunction(@ps_SendSocket, 'procedure SendSocket(Client: integer; Data: string);');
AddFunction(@ps_SetSocketTimeout, 'procedure SetTimeout(Client, Time: integer);'); AddFunction(@ps_SetSocketTimeout, 'procedure SetTimeout(Client, Time: integer);');
AddFunction(@ps_SocketInfo, 'procedure SocketInfo(Client: integer; out IP, Port: string);');
{$ENDIF} {$ENDIF}
{ Color Conversions and Speed } { Color Conversions and Speed }

View File

@ -64,6 +64,7 @@ type
procedure Bind(IP, Port: string); procedure Bind(IP, Port: string);
procedure Listen; procedure Listen;
function Accept: TTCPBlockSocket; function Accept: TTCPBlockSocket;
procedure Info(out IP, Port: string);
constructor Create(Owner: TObject; Socket: TTCPBlockSocket = nil); constructor Create(Owner: TObject; Socket: TTCPBlockSocket = nil);
destructor Destroy; override; destructor Destroy; override;
end; end;
@ -420,6 +421,12 @@ begin
raise Exception.Create('Socket Error ' + IntToStr(Sock.LastError) + ': ' + Sock.LastErrorDesc); raise Exception.Create('Socket Error ' + IntToStr(Sock.LastError) + ': ' + Sock.LastErrorDesc);
end; 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); constructor TSock.Create(Owner: TObject; Socket: TTCPBlockSocket = nil);
begin begin
inherited Create; inherited Create;