How do I Get My Own IP Address?

Posted December 15th @ 4:20 pm by m3Rlin

If you ever needed your own IP address then here it is the code. Please note that in certain situations you may have more than 1 IP address.

uses
Winsock;

function ReadIPs: TStrings;
type
TaPInAddr = array[0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
Buffer: array[0..63] of Char;
iI: Integer;
PPtr: PaPInAddr;
pHE: [...]

How to Check if You are Connected to the Internet

Posted December 15th @ 4:17 pm by m3Rlin

Whenever you try to connect to connect to a Internet server while no Internet connection is present you can be almost certain an Access Violation will fire.
The only way around this is to check whether a connection is present or not. You can use the code below.

uses
Windows, SysUtils, Registry, WinSock, WinInet;

type
TConnectionType [...]

« Previous Entries