Function at 0x406510
Capabilities:
Create tcp socket
Create udp socket
Get socket status
Receive data
Receive data on socket
Send data
Send data on socket
Set socket configuration

Disassembly:
sub esp, 0x354
mov eax, dword [0x427da0]
xor eax, esp
mov dword [esp + 0x350], eax
push ebx
push ebp
push esi
mov esi, dword [esp + 0x364]
push edi
push 0
push 2
push 2
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x24], 0
lea edi, [esi + 0x400]
lea ebx, [esi + 0x800]
mov dword [esp + 0x30], 1
call dword [sym.imp.WSOCK32.dll_socket]
mov ebp, eax
cmp ebp, 0xffffffff
jne 0x406658
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov ebp, eax
cmp ebp, 0x273f
jne 0x4065b8
push 0x96
mov ecx, 0x42e090
call fcn.00405430
test esi, esi
je 0x4065b1
push 0x400
push ebx
push 0x96
mov ecx, 0x42e090
call fcn.00405360
mov eax, str.failed
sub edi, eax
mov cl, byte [eax]
mov byte [edi + eax], cl
add eax, 1
test cl, cl
jne 0x4065a5
xor eax, eax
jmp 0x40663d
push ebp
push 0x6e
push 0x42e090
call fcn.00405510
add esp, 0xc
test esi, esi
je 0x4065f2
push ebp
push 0x6e
push ebx
push 0x42e090
call fcn.00405590
mov eax, str.failed
mov edx, edi
add esp, 0x10
sub edx, eax
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, 1
test cl, cl
jne 0x4065e6
mov edi, dword [esp + 0x10]
mov esi, dword [sym.imp.KERNEL32.dll_InterlockedExchange]
push 0
lea eax, [edi + 0x1468]
push eax
call esi
push 0x71
mov ecx, 0x42e090
call fcn.00405430
push 0
lea ecx, [edi + 0x1314]
push ecx
call esi
mov eax, dword [edi + 0x1450]
test eax, eax
je 0x40662f
push eax
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov eax, dword [esp + 0x18]
mov dword [edi + 0x1450], 0
mov ecx, dword [esp + 0x360]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.0040fac6
add esp, 0x354
ret 4
xor eax, eax
push eax
push eax
lea ecx, [esp + 0x30]
push ecx
push eax
push eax
push 4
lea edx, [esp + 0x44]
push edx
push 0x9800000c
push ebp
mov dword [esp + 0x4c], eax
mov dword [esp + 0x50], eax
call dword [sym.imp.WS2_32.dll_WSAIoctl]
push 4
lea eax, [esp + 0x20]
push eax
push 0x20
push 0xffff
push ebp
mov dword [esp + 0x30], 1
call dword [sym.imp.WSOCK32.dll_setsockopt]
test eax, eax
je 0x4066ff
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
push eax
push 0x6f
push 0x42e090
mov dword [esp + 0x20], eax
call fcn.00405510
add esp, 0xc
test esi, esi
mov dword [esp + 0x18], 0x7d4
je 0x4066ef
mov ecx, dword [esp + 0x14]
push ecx
push 0x6f
push ebx
push 0x42e090
call fcn.00405590
mov eax, str.failed
mov edx, edi
add esp, 0x10
sub edx, eax
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, 1
test cl, cl
jne 0x4066e3
mov edi, dword [esp + 0x10]
push ebp
call dword [sym.imp.WSOCK32.dll_closesocket]
jmp 0x4065f6
push 4
lea edx, [esp + 0x28]
push edx
push 4
push 0xffff
push ebp
call dword [sym.imp.WSOCK32.dll_setsockopt]
cmp eax, 0xffffffff
jne 0x40672f
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov edi, dword [esp + 0x10]
push ebp
call dword [sym.imp.WSOCK32.dll_closesocket]
jmp 0x4065f6
xor eax, eax
mov dword [esp + 0x13c], eax
push eax
mov dword [esp + 0x144], eax
mov dword [esp + 0x148], eax
mov dword [esp + 0x14c], eax
mov word [esp + 0x140], 2
call dword [sym.imp.WSOCK32.dll_htonl]
mov dword [esp + 0x140], eax
mov eax, dword [esp + 0x10]
movzx ecx, word [eax + 0x10]
push ecx
call dword [sym.imp.WSOCK32.dll_htons]
push 0x10
lea edx, [esp + 0x140]
push edx
push ebp
mov word [esp + 0x14a], ax
call dword [sym.imp.WSOCK32.dll_bind]
cmp eax, 0xffffffff
jne 0x4067fc
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
push eax
push 0x70
push 0x42e090
mov dword [esp + 0x20], eax
call fcn.00405510
add esp, 0xc
test esi, esi
mov dword [esp + 0x18], 0x7d5
je 0x4066ef
mov eax, dword [esp + 0x14]
push eax
push 0x70
push ebx
push 0x42e090
call fcn.00405590
mov eax, str.failed
mov edx, edi
add esp, 0x10
sub edx, eax
lea ebx, [ebx]
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, 1
test cl, cl
jne 0x4067e0
mov edi, dword [esp + 0x10]
push ebp
call dword [sym.imp.WSOCK32.dll_closesocket]
jmp 0x4065f6
test esi, esi
je 0x406813
mov eax, str.UdpOK
sub edi, eax
mov cl, byte [eax]
mov byte [edi + eax], cl
add eax, 1
test cl, cl
jne 0x406807
mov edi, dword [esp + 0x10]
mov ecx, dword [edi + 0x10]
push ecx
push 0x6d
push 0x42e090
call fcn.00405510
add esp, 0xc
push 1
lea edx, [edi + 0x1468]
push edx
call dword [sym.imp.KERNEL32.dll_InterlockedExchange]
cmp dword [edi + 0x1314], 0
jne 0x4066f3
mov eax, dword [edi + 0x14]
lea ecx, [esp + 0x30]
push ecx
push 0
push 0
lea edx, [esp + 0x44]
push edx
push 0
mov dword [esp + 0x44], eax
mov dword [esp + 0x48], 0
mov dword [esp + 0x34], 0x10
mov dword [esp + 0x50], ebp
mov dword [esp + 0x4c], 1
call dword [sym.imp.WSOCK32.dll_select]
test eax, eax
je 0x406977
cmp eax, 0xffffffff
je 0x406977
push 0x200
lea eax, [esp + 0x164]
push 0
push eax
call fcn.0040fd40
add esp, 0xc
lea ecx, [esp + 0x20]
push ecx
lea edx, [esp + 0x150]
push edx
push 0
push 0x200
lea eax, [esp + 0x170]
push eax
push ebp
call dword [sym.imp.WSOCK32.dll_recvfrom]
mov esi, eax
cmp esi, 0xffffffff
jne 0x4068df
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
push eax
push 0x72
jmp 0x40696a
cmp dword [edi + 0x1460], 0
je 0x40690a
mov ecx, dword [esp + 0x150]
push esi
push ecx
call dword [sym.imp.WSOCK32.dll_inet_ntoa]
push eax
push str.UDP_recv_data_ip__s_len__d_n
push 0x42e090
call fcn.00405490
add esp, 0x10
push esi
lea edx, [esp + 0x150]
mov ebx, 2
push edx
mov ecx, edi
mov word [esp + 0x154], bx
call fcn.004064a0
test eax, eax
mov word [esp + 0x14c], bx
je 0x406977
push 0x10
lea ecx, [esp + 0x150]
push ecx
push 0
push eax
lea edx, [esp + 0x170]
push edx
push ebp
call dword [sym.imp.WSOCK32.dll_sendto]
test eax, eax
je 0x406961
cmp dword [edi + 0x1460], 0
je 0x406977
push eax
push 0x7b
jmp 0x40696a
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
push eax
push 0x7c
push 0x42e090
call fcn.00405510
add esp, 0xc
cmp dword [edi + 0x1314], 0
je 0x406846
push ebp
call dword [sym.imp.WSOCK32.dll_closesocket]
jmp 0x4065f6