Function at 0x406610
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, 0x3cc
mov eax, dword [0x411ce4]
xor eax, esp
mov dword [esp + 0x3c8], eax
push ebx
push ebp
push esi
mov esi, dword [esp + 0x3dc]
push edi
push 0
push 2
push 0x17
mov dword [esp + 0x20], ecx
mov dword [esp + 0x24], 0
lea edi, [esi + 0x400]
lea ebp, [esi + 0x800]
mov dword [esp + 0x28], 1
call dword [sym.imp.WSOCK32.dll_socket]
mov ebx, eax
cmp ebx, 0xffffffff
mov dword [esp + 0x10], ebx
jne 0x406708
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
cmp eax, 0x273f
mov dword [esp + 0x10], eax
jne 0x4066c3
push 0x96
mov ecx, 0x414df0
call fcn.00405400
test esi, esi
je 0x4066bc
push 0x400
push ebp
push 0x96
mov ecx, 0x414df0
call fcn.00405330
mov eax, str.failed
sub edi, eax
lea ebx, [ebx]
mov cl, byte [eax]
mov byte [edi + eax], cl
add eax, 1
test cl, cl
jne 0x4066b0
xor eax, eax
jmp 0x406907
push eax
push 0x6e
push 0x414df0
call fcn.004054e0
add esp, 0xc
test esi, esi
je 0x4068b5
mov eax, dword [esp + 0x10]
push eax
push 0x6e
push ebp
push 0x414df0
call fcn.00405560
mov eax, str.failed
add esp, 0x10
sub edi, eax
mov cl, byte [eax]
mov byte [edi + eax], cl
add eax, 1
test cl, cl
jne 0x4066f7
jmp 0x4068b5
xor eax, eax
push eax
push eax
lea ecx, [esp + 0x2c]
push ecx
push eax
push eax
push 4
lea edx, [esp + 0x40]
push edx
push 0x9800000c
push ebx
mov dword [esp + 0x48], eax
mov dword [esp + 0x4c], eax
call dword [sym.imp.WS2_32.dll_WSAIoctl]
push 4
lea eax, [esp + 0x24]
push eax
push 0x20
push 0xffff
push ebx
mov dword [esp + 0x34], 1
call dword [sym.imp.WSOCK32.dll_setsockopt]
test eax, eax
je 0x4067a6
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
push eax
push 0x6f
push 0x414df0
mov dword [esp + 0x1c], eax
call fcn.004054e0
add esp, 0xc
test esi, esi
mov dword [esp + 0x18], 0x7d4
je 0x4068b5
mov ecx, dword [esp + 0x10]
push ecx
push 0x6f
push ebp
push 0x414df0
call fcn.00405560
mov eax, str.failed
add esp, 0x10
sub edi, eax
mov cl, byte [eax]
mov byte [edi + eax], cl
add eax, 1
test cl, cl
jne 0x406795
jmp 0x4068b5
push 4
lea edx, [esp + 0x20]
push edx
push 4
push 0xffff
push ebx
call dword [sym.imp.WSOCK32.dll_setsockopt]
test eax, eax
je 0x4067ca
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
jmp 0x4068b5
mov ecx, dword [0x40db74]
mov edx, dword [0x40db78]
xor eax, eax
mov dword [esp + 0x148], eax
mov dword [esp + 0x14c], eax
mov dword [esp + 0x13c], eax
mov dword [esp + 0x144], eax
mov dword [esp + 0x150], eax
mov dword [esp + 0x148], ecx
mov ecx, dword [esp + 0x14]
mov dword [esp + 0x140], eax
mov dword [esp + 0x154], eax
mov eax, dword [0x40db70]
mov dword [esp + 0x14c], edx
movzx edx, word [ecx + 0x10]
mov dword [esp + 0x144], eax
mov eax, dword [0x40db7c]
push edx
mov word [esp + 0x140], 0x17
mov dword [esp + 0x154], eax
call dword [sym.imp.WSOCK32.dll_htons]
mov word [esp + 0x13e], ax
push 0x1c
lea eax, [esp + 0x140]
push eax
push ebx
call dword [sym.imp.WSOCK32.dll_bind]
test eax, eax
je 0x406922
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov ebx, eax
push ebx
push 0x70
push 0x414df0
call fcn.004054e0
add esp, 0xc
test esi, esi
mov dword [esp + 0x18], 0x7d5
je 0x4068b1
push ebx
push 0x70
push ebp
push 0x414df0
call fcn.00405560
mov eax, str.failed
add esp, 0x10
sub edi, eax
mov cl, byte [eax]
mov byte [edi + eax], cl
add eax, 1
test cl, cl
jne 0x4068a5
mov ebx, dword [esp + 0x10]
push ebx
call dword [sym.imp.WSOCK32.dll_closesocket]
mov esi, dword [esp + 0x14]
mov edi, dword [sym.imp.KERNEL32.dll_InterlockedExchange]
push 0
lea edx, [esi + 0x1468]
push edx
call edi
push 0x71
mov ecx, 0x414df0
call fcn.00405400
push 0
lea eax, [esi + 0x1314]
push eax
call edi
mov eax, dword [esi + 0x1450]
test eax, eax
je 0x4068f9
push eax
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov eax, dword [esp + 0x18]
mov dword [esi + 0x1450], 0
mov ecx, dword [esp + 0x3d8]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.0040c056
add esp, 0x3cc
ret 4
xor ebp, ebp
cmp esi, ebp
je 0x40693c
mov eax, str.UdpOK
sub edi, eax
nop
mov cl, byte [eax]
mov byte [edi + eax], cl
add eax, 1
test cl, cl
jne 0x406930
mov esi, dword [esp + 0x14]
mov ecx, dword [esi + 0x10]
push ecx
push 0x6d
push 0x414df0
call fcn.004054e0
add esp, 0xc
push 1
lea edx, [esi + 0x1468]
push edx
call dword [sym.imp.KERNEL32.dll_InterlockedExchange]
cmp dword [esi + 0x1314], ebp
jne 0x4068b5
mov edi, edi
mov eax, dword [esi + 0x14]
lea ecx, [esp + 0x38]
push ecx
push ebx
mov dword [esp + 0x40], ebp
mov dword [esp + 0x38], eax
mov dword [esp + 0x3c], ebp
mov dword [esp + 0x34], 0x10
call sub.WSOCK32.dll___WSAFDIsSet
test eax, eax
jne 0x4069bf
mov ecx, dword [esp + 0x38]
cmp ecx, ebp
jbe 0x4069ad
mov edi, edi
cmp dword [esp + eax*4 + 0x3c], ebx
je 0x4069ad
add eax, 1
cmp eax, ecx
jb 0x4069a0
cmp eax, ecx
jne 0x4069bf
cmp ecx, 0x40
jae 0x4069bf
mov dword [esp + eax*4 + 0x3c], ebx
add dword [esp + 0x38], 1
lea edx, [esp + 0x30]
push edx
push ebp
push ebp
lea eax, [esp + 0x44]
push eax
lea eax, [ebx + 1]
push eax
call dword [sym.imp.WSOCK32.dll_select]
cmp eax, ebp
je 0x406adb
cmp eax, 0xffffffff
je 0x406adb
lea ecx, [esp + 0x2c]
push ecx
lea edx, [esp + 0x178]
push edx
push ebp
push 0x200
lea eax, [esp + 0x1a4]
push eax
push ebx
call dword [sym.imp.WSOCK32.dll_recvfrom]
mov ebp, eax
cmp ebp, 0xffffffff
jne 0x406a1d
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
push eax
push 0x72
jmp 0x406ace
mov ecx, 7
lea esi, [esp + 0x174]
lea edi, [esp + 0x158]
rep movsd dword es:[edi], dword [esi]
lea ecx, [esp + 0x10]
push ecx
lea edx, [esp + 0x398]
push edx
push 0
push 0x1c
lea eax, [esp + 0x168]
push eax
mov dword [esp + 0x24], 0x41
call dword [sym.imp.WS2_32.dll_WSAAddressToStringA]
mov esi, dword [esp + 0x14]
cmp dword [esi + 0x1460], 0
je 0x406a81
push ebp
lea ecx, [esp + 0x398]
push ecx
push str.UDP_recv_data_ip__s_len__d_n
push 0x414df0
call fcn.00405460
add esp, 0x10
push ebp
lea edx, [esp + 0x178]
push edx
mov ecx, esi
call fcn.004065a0
test eax, eax
je 0x406adb
push 0x1c
lea ecx, [esp + 0x178]
push ecx
push 0
push eax
lea edx, [esp + 0x1a4]
push edx
push ebx
call dword [sym.imp.WSOCK32.dll_sendto]
test eax, eax
je 0x406ac5
mov ecx, esi
cmp dword [ecx + 0x1460], 0
je 0x406adb
push eax
push 0x7b
jmp 0x406ace
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
push eax
push 0x7c
push 0x414df0
call fcn.004054e0
add esp, 0xc
mov esi, dword [esp + 0x14]
xor ebp, ebp
cmp dword [esi + 0x1314], ebp
je 0x406970
jmp 0x4068b5