Function at 0x406c10
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
sub esp, 0x184
push ebx
push esi
push edi
lea edi, [ebp - 0x184]
mov ecx, 0x61
mov eax, 0xcccccccc
rep stosd dword es:[edi], eax
mov dword [ebp - 0x30], 1
mov dword [ebp - 0x34], 0
mov dword [0x5de66c], 0
movsx eax, word [ebp + 8]
imul eax, eax, 0x84
add eax, 0x5d6264
mov dword [ebp - 0x14], eax
mov ecx, dword [ebp - 0x14]
mov dword [ecx + 0x34], 2
cmp dword [0x4b8704], 0
jne 0x406c7a
call fcn.00416da0
mov dword [0x4b8704], 1
mov esi, esp
push 0
push 1
push 2
call dword [sym.imp.WS2_32.dll_socket]
cmp esi, esp
call sub.MSVCRTD.dll__chkesp
mov dword [ebp - 0x28], eax
cmp dword [ebp - 0x28], 0xffffffff
jne 0x406cd5
cmp dword [0x4b8708], 0
je 0x406cc3
call fcn.00401dc0
mov esi, esp
push eax
movsx edx, word [ebp + 8]
push edx
push str.socket_Create_Error__d_ErroNo:0x_x_n
call dword [sym.imp.MSVCRTD.dll_printf]
add esp, 0xc
cmp esi, esp
call sub.MSVCRTD.dll__chkesp
mov eax, dword [ebp - 0x14]
mov dword [eax + 0x34], 1
or eax, 0xffffffff
jmp 0x406f60
mov dword [ebp - 0x24], 0x10
mov ecx, dword [ebp - 0x24]
push ecx
lea edx, [ebp - 0x10]
push edx
call fcn.00401da0
add esp, 8
mov word [ebp - 0x10], 2
mov esi, esp
mov eax, dword [ebp - 0x14]
mov cx, word [eax + 0x28]
push ecx
call dword [sym.imp.WS2_32.dll_htons]
cmp esi, esp
call sub.MSVCRTD.dll__chkesp
mov word [ebp - 0xe], ax
mov esi, esp
mov edx, dword [ebp - 0x14]
push edx
call dword [sym.imp.WS2_32.dll_inet_addr]
cmp esi, esp
call sub.MSVCRTD.dll__chkesp
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0xffffffff
jne 0x406d6d
cmp dword [0x4b8708], 0
je 0x406d4f
call fcn.00401dc0
mov esi, esp
push eax
push str.Unknow_serverName_ErroNo:0x_x_n
call dword [sym.imp.MSVCRTD.dll_printf]
add esp, 8
cmp esi, esp
call sub.MSVCRTD.dll__chkesp
mov eax, dword [ebp - 0x14]
mov dword [eax + 0x34], 1
mov ecx, dword [ebp - 0x28]
push ecx
call sub.MSVCRTD.dll__close
add esp, 4
or eax, 0xffffffff
jmp 0x406f60
mov edx, dword [ebp - 0x14]
movsx eax, word [edx + 0x74]
test eax, eax
jne 0x406d81
mov dword [ebp - 0x20], 0
jmp 0x406d98
mov ecx, dword [ebp - 0x14]
movsx edx, word [ecx + 0x74]
mov dword [ebp - 0x1c], edx
mov dword [ebp - 0x18], 0
lea eax, [ebp - 0x1c]
mov dword [ebp - 0x20], eax
mov esi, esp
lea ecx, [ebp - 0x30]
push ecx
push 0x8004667e
mov edx, dword [ebp - 0x28]
push edx
call dword [sym.imp.WS2_32.dll_ioctlsocket]
cmp esi, esp
call sub.MSVCRTD.dll__chkesp
mov dword [ebp - 0x2c], eax
cmp dword [ebp - 0x2c], 0xffffffff
jne 0x406dc4
xor eax, eax
jmp 0x406f60
mov esi, esp
mov eax, dword [ebp - 0x24]
push eax
lea ecx, [ebp - 0x10]
push ecx
mov edx, dword [ebp - 0x28]
push edx
call dword [sym.imp.WS2_32.dll_connect]
cmp esi, esp
call sub.MSVCRTD.dll__chkesp
mov dword [ebp - 0x140], 0
mov dword [ebp - 0x144], 0
jmp 0x406e04
mov eax, dword [ebp - 0x144]
add eax, 1
mov dword [ebp - 0x144], eax
mov ecx, dword [ebp - 0x144]
cmp ecx, dword [ebp - 0x140]
jae 0x406e28
mov edx, dword [ebp - 0x144]
mov eax, dword [ebp + edx*4 - 0x13c]
cmp eax, dword [ebp - 0x28]
jne 0x406e26
jmp 0x406e28
jmp 0x406df5
mov ecx, dword [ebp - 0x144]
cmp ecx, dword [ebp - 0x140]
jne 0x406e5e
cmp dword [ebp - 0x140], 0x40
jae 0x406e5e
mov edx, dword [ebp - 0x144]
mov eax, dword [ebp - 0x28]
mov dword [ebp + edx*4 - 0x13c], eax
mov ecx, dword [ebp - 0x140]
add ecx, 1
mov dword [ebp - 0x140], ecx
xor edx, edx
test edx, edx
jne 0x406de9
mov dword [ebp - 0x3c], 0xa
mov dword [ebp - 0x38], 0
mov esi, esp
lea eax, [ebp - 0x3c]
push eax
push 0
lea ecx, [ebp - 0x140]
push ecx
push 0
mov edx, dword [ebp - 0x28]
add edx, 1
push edx
call dword [sym.imp.WS2_32.dll_select]
cmp esi, esp
call sub.MSVCRTD.dll__chkesp
mov dword [ebp - 0x2c], eax
cmp dword [ebp - 0x2c], 0
jg 0x406efc
mov eax, dword [ebp - 0x28]
push eax
call sub.MSVCRTD.dll__close
add esp, 4
mov ecx, dword [ebp - 0x14]
mov dword [ecx + 0x34], 1
cmp dword [0x4b8708], 0
je 0x406eed
call fcn.00401650
call fcn.00401dc0
mov esi, esp
push eax
mov edx, dword [ebp - 0x14]
movsx eax, word [edx + 0x28]
push eax
mov ecx, dword [ebp - 0x14]
push ecx
push str.Connect_to__s:_d_Error_ErroNo:0x_x_n
call dword [sym.imp.MSVCRTD.dll_printf]
add esp, 0x10
cmp esi, esp
call sub.MSVCRTD.dll__chkesp
mov dword [0x5de66c], 1
or eax, 0xffffffff
jmp 0x406f60
mov esi, esp
lea edx, [ebp - 0x34]
push edx
push 0x8004667e
mov eax, dword [ebp - 0x28]
push eax
call dword [sym.imp.WS2_32.dll_ioctlsocket]
cmp esi, esp
call sub.MSVCRTD.dll__chkesp
mov dword [ebp - 0x2c], eax
cmp dword [ebp - 0x2c], 0xffffffff
jne 0x406f42
mov esi, esp
mov ecx, dword [ebp - 0x28]
push ecx
call dword [sym.imp.WS2_32.dll_closesocket]
cmp esi, esp
call sub.MSVCRTD.dll__chkesp
mov dword [0x5de66c], 1
xor eax, eax
jmp 0x406f60
mov dword [0x5de66c], 2
mov edx, dword [ebp - 0x28]
push edx
mov ax, word [ebp + 8]
push eax
call fcn.00406590
add esp, 8
mov eax, dword [ebp - 0x28]
pop edi
pop esi
pop ebx
add esp, 0x184
cmp ebp, esp
call sub.MSVCRTD.dll__chkesp
mov esp, ebp
pop ebp
ret