Function at 0x402689
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Connect udp socket
Create tcp socket
Create udp socket
Get socket status
Set socket configuration

Disassembly:
push ebp
mov ebp, esp
add esp, 0xfffffdc8
push ebx
push esi
push edi
mov edi, dword [ebp + 0x14]
call fcn.0040264a
mov esi, eax
cmp esi, 0xffffffff
jne 0x4026ae
mov eax, 0xfffffffa
jmp 0x402932
push 0
push 1
push 2
call sub.WSOCK32.dll_socket
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x4026db
call sub.KERNEL32.dll_GetLastError
push eax
push 0x40d397
call fcn.00406420
add esp, 8
or eax, 0xffffffff
jmp 0x402932
mov dword [ebp - 0x10], 1
push 4
lea edx, [ebp - 0x10]
push edx
push 0xe
push 0
push ebx
call sub.WSOCK32.dll_setsockopt
lea ecx, [ebp - 0x20]
push ecx
push dword [ebp + 8]
call fcn.004025f2
add esp, 8
test ax, ax
jge 0x402723
call sub.KERNEL32.dll_GetLastError
push eax
push str.Error__d
call fcn.00406420
add esp, 8
mov eax, 0xfffffffd
jmp 0x402932
cmp dword [0x42d5c0], 0
je 0x40273e
lea edx, [ebp - 0x20]
push edx
call fcn.00402667
pop ecx
mov edi, eax
add edi, 0x7d0
lea eax, [ebp - 0x20]
push eax
call fcn.004024d4
pop ecx
mov dword [ebp - 0x2c], eax
cmp dword [ebp - 0x2c], 0
je 0x402909
push 0xa
lea edx, [ebp - 0x20]
push edx
push edi
call fcn.00408d48
add esp, 0xc
lea ecx, [ebp - 0x20]
push ecx
call fcn.0040251d
pop ecx
mov word [ebp - 0x2e], ax
cmp word [ebp - 0x2e], 0
je 0x402909
push str.TCP_IP
push dword [ebp + 0xc]
call fcn.00402b98
add esp, 8
test eax, eax
je 0x40279b
mov eax, 0xfffffffe
jmp 0x402932
mov word [ebp - 0x30], 2
mov dword [ebp - 0xc], 1
lea edx, [ebp - 0xc]
push edx
push 0x8004667e
push ebx
call sub.WSOCK32.dll_ioctlsocket
push 0x10
lea ecx, [ebp - 0x30]
push ecx
push ebx
call sub.WSOCK32.dll_connect
mov edi, eax
inc edi
jne 0x402909
call sub.KERNEL32.dll_GetLastError
mov edi, eax
cmp edi, 0x2733
jne 0x4028ee
xor eax, eax
mov dword [ebp - 0x134], eax
xor edx, edx
mov dword [ebp - 0x238], edx
xor eax, eax
jmp 0x4027fd
cmp ebx, dword [ebp + eax*4 - 0x130]
je 0x402805
inc eax
cmp eax, dword [ebp - 0x134]
jb 0x4027f3
cmp eax, dword [ebp - 0x134]
jne 0x402823
cmp dword [ebp - 0x134], 0x40
jae 0x402823
mov dword [ebp + eax*4 - 0x130], ebx
inc dword [ebp - 0x134]
xor eax, eax
jmp 0x402831
cmp ebx, dword [ebp + eax*4 - 0x234]
je 0x402839
inc eax
cmp eax, dword [ebp - 0x238]
jb 0x402827
cmp eax, dword [ebp - 0x238]
jne 0x402857
cmp dword [ebp - 0x238], 0x40
jae 0x402857
mov dword [ebp + eax*4 - 0x234], ebx
inc dword [ebp - 0x238]
mov dword [ebp - 8], 3
xor edx, edx
mov dword [ebp - 4], edx
lea ecx, [ebp - 8]
push ecx
lea eax, [ebp - 0x238]
push eax
lea edx, [ebp - 0x134]
push edx
push 0
push edi
call sub.WSOCK32.dll_select
mov edi, eax
dec edi
jge 0x4028a5
mov edi, 0x274c
push ebx
call sub.WSOCK32.dll_closesocket
push edi
push 0x40d3b0
call fcn.00406420
add esp, 8
mov eax, 0xfffffffb
jmp 0x402932
lea edx, [ebp - 0x238]
push edx
push ebx
call sub.WSOCK32.dll___WSAFDIsSet
test eax, eax
je 0x4028d8
call sub.KERNEL32.dll_GetLastError
mov edi, eax
push ebx
call sub.WSOCK32.dll_closesocket
push edi
push 0x40d3c1
call fcn.00406420
add esp, 8
mov eax, 0xfffffffb
jmp 0x402932
xor edx, edx
mov dword [ebp - 0xc], edx
lea ecx, [ebp - 0xc]
push ecx
push 0x8004667e
push ebx
call sub.WSOCK32.dll_ioctlsocket
jmp 0x402909
push ebx
call sub.WSOCK32.dll_closesocket
push edi
push str.Connect_error__d
call fcn.00406420
add esp, 8
mov eax, 0xfffffffb
jmp 0x402932
lea edx, [esi + esi*2]
mov dword [edx*8 + 0x42d5c4], ebx
push 0x10
lea ecx, [ebp - 0x30]
push ecx
mov eax, esi
shl eax, 3
lea eax, [eax + eax*2]
add eax, 0x42d5c8
push eax
call fcn.00402a48
add esp, 0xc
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret