Function at 0x515877
Capabilities:
Check for time delay via gettickcount
Connect socket
Set socket configuration

Disassembly:
mov eax, 0x5ae13e
call fcn.00591b5c
sub esp, 0xdc
mov eax, dword [0x6c0bc0]
xor eax, dword [ebp + 4]
mov dword [ebp - 0x5c], eax
mov dword [ebp - 0xe8], ecx
mov eax, dword [ebp - 0xe8]
and dword [eax + 0xe0], 0
mov eax, dword [ebp + 0x14]
and byte [eax], 0
mov ecx, dword [ebp - 0xe8]
add ecx, 0xc4
call fcn.004cd0cb
cmp dword [ebp + 8], 0
jne 0x5158e9
mov eax, dword [ebp - 0xe8]
mov dword [eax + 0xe0], 1
push str.Cannot_connect__hostname_is_NULL
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
mov ecx, dword [ebp + 0x10]
call dword [eax + 0x10]
xor al, al
jmp 0x515f76
push dword [ebp + 8]
lea ecx, [ebp - 0x54]
call fcn.004cdd83
and dword [ebp - 4], 0
lea ecx, [ebp - 0x54]
call fcn.004ccd7e
lea ecx, [ebp - 0x54]
call fcn.004ccbf8
test eax, eax
jne 0x51594a
mov eax, dword [ebp - 0xe8]
mov dword [eax + 0xe0], 1
push str.Cannot_connect__hostname_is_zero_length
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
mov ecx, dword [ebp + 0x10]
call dword [eax + 0x10]
and byte [ebp - 0xdd], 0
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x54]
call fcn.004ce1b7
mov al, byte [ebp - 0xdd]
jmp 0x515f76
push str.localhost
lea ecx, [ebp - 0x54]
call fcn.004cffb2
movzx eax, al
test eax, eax
je 0x51598c
push str.127.0.0.1
mov ecx, dword [ebp - 0xe8]
add ecx, 0xc4
call fcn.004cf872
push str.127.0.0.1
lea ecx, [ebp - 0x54]
call fcn.004cf872
lea ecx, [ebp - 0x54]
call fcn.0055420c
mov dword [ebp + 8], eax
movzx eax, byte [0x671264]
test eax, eax
je 0x5159a0
push dword [ebp + 0x10]
call fcn.005148d2
pop ecx
push 0x10
push 0
lea eax, [ebp - 0x6c]
push eax
call fcn.0058ee10
add esp, 0xc
mov word [ebp - 0x6c], 2
push dword [ebp + 0xc]
call dword [sym.imp.WS2_32.dll_htons]
mov word [ebp - 0x6a], ax
push dword [ebp + 8]
call dword [sym.imp.WS2_32.dll_inet_addr]
mov dword [ebp - 0x68], eax
lea ecx, [ebp - 0x28]
call fcn.004cde9c
mov byte [ebp - 4], 1
and dword [ebp - 0x2c], 0
cmp dword [ebp - 0x68], 0xffffffff
jne 0x515c68
mov eax, dword [ebp - 0xe8]
mov eax, dword [eax + 0xbc]
mov dword [ebp - 0xcc], eax
and byte [ebp - 0xc5], 0
and byte [ebp - 0xd1], 0
mov dword [ebp - 0xd0], 0xc8
lea ecx, [ebp - 0xc4]
call fcn.004f1e31
mov byte [ebp - 4], 2
call dword [sym.imp.KERNEL32.dll_GetTickCount]
mov dword [ebp - 0x70], eax
lea eax, [ebp - 0xd1]
push eax
lea eax, [ebp - 0xc5]
push eax
lea eax, [ebp - 0x2c]
push eax
lea eax, [ebp - 0x28]
push eax
lea eax, [ebp - 0xc4]
push eax
push dword [ebp + 0x10]
push dword [ebp - 0xd0]
mov eax, dword [ebp - 0xe8]
push dword [eax + 0xbc]
push 0
mov eax, dword [ebp - 0xe8]
push dword [eax + 0x50]
push dword [ebp + 8]
call fcn.0051531e
add esp, 0x2c
mov byte [ebp - 0x71], al
lea eax, [ebp - 0x28]
push eax
mov ecx, dword [ebp - 0xe8]
add ecx, 0xc4
call fcn.004cf8e2
movzx eax, byte [ebp - 0x71]
test eax, eax
je 0x515afb
lea ecx, [ebp - 0x28]
call fcn.004ccbf8
test eax, eax
je 0x515afb
cmp dword [ebp - 0x2c], 0
je 0x515aad
mov eax, dword [ebp - 0x2c]
mov dword [ebp - 0x68], eax
jmp 0x515af6
mov eax, dword [ebp - 0xe8]
mov dword [eax + 0xe0], 2
and byte [ebp - 0xde], 0
mov byte [ebp - 4], 1
lea ecx, [ebp - 0xc4]
call fcn.004f1f7d
and byte [ebp - 4], 0
lea ecx, [ebp - 0x28]
call fcn.004ce1b7
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x54]
call fcn.004ce1b7
mov al, byte [ebp - 0xde]
jmp 0x515f76
jmp 0x515ba7
mov eax, dword [ebp + 0x14]
mov byte [eax], 1
push str.Cannot_get_host_by_name.
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
mov ecx, dword [ebp + 0x10]
call dword [eax + 0x10]
push dword [ebp + 8]
push str.hostname
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
mov ecx, dword [ebp + 0x10]
call dword [eax + 0x28]
movzx eax, byte [ebp - 0xc5]
test eax, eax
je 0x515b41
mov eax, dword [ebp - 0xe8]
mov dword [eax + 0xe0], 4
jmp 0x515b6e
movzx eax, byte [ebp - 0xd1]
test eax, eax
je 0x515b5e
mov eax, dword [ebp - 0xe8]
mov dword [eax + 0xe0], 3
jmp 0x515b6e
mov eax, dword [ebp - 0xe8]
mov dword [eax + 0xe0], 2
and byte [ebp - 0xdf], 0
mov byte [ebp - 4], 1
lea ecx, [ebp - 0xc4]
call fcn.004f1f7d
and byte [ebp - 4], 0
lea ecx, [ebp - 0x28]
call fcn.004ce1b7
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x54]
call fcn.004ce1b7
mov al, byte [ebp - 0xdf]
jmp 0x515f76
cmp dword [ebp - 0xcc], 0
je 0x515c57
call dword [sym.imp.KERNEL32.dll_GetTickCount]
mov dword [ebp - 0xd8], eax
mov eax, dword [ebp - 0xd8]
cmp eax, dword [ebp - 0x70]
jbe 0x515c57
mov eax, dword [ebp - 0xd8]
sub eax, dword [ebp - 0x70]
mov dword [ebp - 0xdc], eax
mov eax, dword [ebp - 0xdc]
cmp eax, dword [ebp - 0xcc]
jb 0x515c45
mov eax, dword [ebp - 0xe8]
mov dword [eax + 0xe0], 3
push str.Application_timeout_after_DNS
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
mov ecx, dword [ebp + 0x10]
call dword [eax + 0x10]
and byte [ebp - 0xe0], 0
mov byte [ebp - 4], 1
lea ecx, [ebp - 0xc4]
call fcn.004f1f7d
and byte [ebp - 4], 0
lea ecx, [ebp - 0x28]
call fcn.004ce1b7
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x54]
call fcn.004ce1b7
mov al, byte [ebp - 0xe0]
jmp 0x515f76
mov eax, dword [ebp - 0xcc]
sub eax, dword [ebp - 0xdc]
mov dword [ebp - 0xcc], eax
mov byte [ebp - 4], 1
lea ecx, [ebp - 0xc4]
call fcn.004f1f7d
jmp 0x515c7c
push dword [ebp + 8]
mov ecx, dword [ebp - 0xe8]
add ecx, 0xc4
call fcn.004cf872
push dword [ebp + 0x10]
mov ecx, dword [ebp - 0xe8]
call fcn.00514bad
mov byte [ebp - 0x55], al
movzx eax, byte [ebp - 0x55]
test eax, eax
je 0x515ca1
mov eax, dword [ebp - 0xe8]
cmp dword [eax + 0x4c], 0xffffffff
jne 0x515ceb
mov eax, dword [ebp - 0xe8]
mov dword [eax + 0xe0], 5
push str.Cannot_connect__invalid_socket.
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
mov ecx, dword [ebp + 0x10]
call dword [eax + 0x10]
and byte [ebp - 0xe1], 0
and byte [ebp - 4], 0
lea ecx, [ebp - 0x28]
call fcn.004ce1b7
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x54]
call fcn.004ce1b7
mov al, byte [ebp - 0xe1]
jmp 0x515f76
mov dword [ebp - 0x38], 1
mov eax, dword [ebp - 0xe8]
cmp dword [eax + 0xbc], 0
je 0x515d19
lea eax, [ebp - 0x38]
push eax
push 0x8004667e
mov eax, dword [ebp - 0xe8]
push dword [eax + 0x4c]
call dword [sym.imp.WS2_32.dll_ioctlsocket]
and byte [ebp - 0x56], 0
and dword [ebp - 0x30], 0
and byte [ebp - 0x56], 0
push 0x10
lea eax, [ebp - 0x6c]
push eax
mov eax, dword [ebp - 0xe8]
push dword [eax + 0x4c]
call dword [sym.imp.WS2_32.dll_connect]
mov dword [ebp - 0x34], eax
cmp dword [ebp - 0x34], 0
je 0x515dcd
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov dword [ebp - 0x30], eax
cmp dword [ebp - 0x30], 0x2733
je 0x515dcd
cmp dword [ebp - 0x30], 0x2726
jne 0x515dba
lea ecx, [ebp - 0x28]
call fcn.0055420c
push eax
push str.IP_Address
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
mov ecx, dword [ebp + 0x10]
call dword [eax + 0x28]
push dword [ebp - 0x2c]
push str.ipAddr
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
mov ecx, dword [ebp + 0x10]
call dword [eax + 0x34]
push dword [ebp + 8]
push str.Hostname
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
mov ecx, dword [ebp + 0x10]
call dword [eax + 0x28]
mov eax, dword [ebp - 0xe8]
push dword [eax + 0x4c]
push str.SocketHandle
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
mov ecx, dword [ebp + 0x10]
call dword [eax + 0x34]
push dword [ebp - 0x30]
push str.sockError
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
mov ecx, dword [ebp + 0x10]
call dword [eax + 0x2c]
cmp dword [ebp - 0x34], 0
je 0x515e7a
mov eax, dword [ebp - 0xe8]
cmp dword [eax + 0xbc], 0
je 0x515e7a
cmp dword [ebp - 0x30], 0x2733
jne 0x515e7a
push dword [ebp + 0x10]
mov eax, dword [ebp - 0xe8]
push dword [eax + 0xbc]
mov ecx, dword [ebp - 0xe8]
call fcn.0051675a
movzx eax, al
test eax, eax
je 0x515e76
and dword [ebp - 0x38], 0
lea eax, [ebp - 0x38]
push eax
push 0x8004667e
mov eax, dword [ebp - 0xe8]
push dword [eax + 0x4c]
call dword [sym.imp.WS2_32.dll_ioctlsocket]
mov eax, dword [ebp - 0xe8]
mov byte [eax + 0x48], 1
mov ecx, dword [ebp - 0xe8]
add ecx, 0x54
call fcn.0053b764
mov byte [ebp - 0xe2], 1
and byte [ebp - 4], 0
lea ecx, [ebp - 0x28]
call fcn.004ce1b7
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x54]
call fcn.004ce1b7
mov al, byte [ebp - 0xe2]
jmp 0x515f76
mov byte [ebp - 0x56], 1
mov eax, dword [ebp - 0xe8]
cmp dword [eax + 0xbc], 0
je 0x515ea5
and dword [ebp - 0x38], 0
lea eax, [ebp - 0x38]
push eax
push 0x8004667e
mov eax, dword [ebp - 0xe8]
push dword [eax + 0x4c]
call dword [sym.imp.WS2_32.dll_ioctlsocket]
cmp dword [ebp - 0x34], 0
jne 0x515f06
mov eax, dword [ebp - 0xe8]
mov byte [eax + 0x48], 1
mov ecx, dword [ebp - 0xe8]
add ecx, 0x54
call fcn.0053b764
mov ecx, dword [ebp - 0xe8]
add ecx, 8
call fcn.0053b784
mov ecx, dword [ebp - 0xe8]
add ecx, 0x28
call fcn.0053b784
mov byte [ebp - 0xe3], 1
and byte [ebp - 4], 0
lea ecx, [ebp - 0x28]
call fcn.004ce1b7
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x54]
call fcn.004ce1b7
mov al, byte [ebp - 0xe3]
jmp 0x515f76
movzx eax, byte [ebp - 0x56]
test eax, eax
je 0x515f20
mov eax, dword [ebp - 0xe8]
mov dword [eax + 0xe0], 6
jmp 0x515f30
mov eax, dword [ebp - 0xe8]
mov dword [eax + 0xe0], 7
push str.Connect_function_failed.
mov eax, dword [ebp + 0x10]
mov eax, dword [eax]
mov ecx, dword [ebp + 0x10]
call dword [eax + 0x10]
push dword [ebp + 0x10]
push dword [ebp - 0x30]
mov ecx, dword [ebp - 0xe8]
call fcn.00514f71
and byte [ebp - 0xe4], 0
and byte [ebp - 4], 0
lea ecx, [ebp - 0x28]
call fcn.004ce1b7
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x54]
call fcn.004ce1b7
mov al, byte [ebp - 0xe4]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
mov ecx, dword [ebp - 0x5c]
xor ecx, dword [ebp + 4]
call fcn.0058cc82
leave
ret 0x10