1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-21 16:55:01 -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);
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();

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_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 }

View File

@ -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;