Function at 0x406990
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
Start tcp server

Disassembly:
sub esp, 0x350
mov eax, dword [0x427da0]
xor eax, esp
mov dword [esp + 0x34c], eax
push ebx
push ebp
push esi
mov esi, dword [esp + 0x360]
push edi
push 6
push 1
push 2
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x28], 0
lea ebx, [esi + 0x400]
lea ebp, [esi + 0x800]
mov dword [esp + 0x3c], 1
call dword [sym.imp.WSOCK32.dll_socket]
mov edi, eax
cmp edi, 0xffffffff
mov dword [esp + 0x18], edi
jne 0x406a51
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov edi, eax
cmp edi, 0x273f
jne 0x406a0c
push 0x95
mov ecx, 0x42e090
call fcn.00405430
xor eax, eax
jmp 0x406b82
push edi
push 0x75
push 0x42e090
call fcn.00405510
add esp, 0xc
test esi, esi
je 0x406b37
push edi
push 0x75
push ebp
push 0x42e090
call fcn.00405590
mov eax, str.failed
mov edx, ebx
add esp, 0x10
sub edx, eax
mov edi, edi
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, 1
test cl, cl
jne 0x406a40
jmp 0x406b37
push 4
lea eax, [esp + 0x34]
push eax
push 4
push 0xffff
push edi
call dword [sym.imp.WSOCK32.dll_setsockopt]
cmp eax, 0xffffffff
jne 0x406a76
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
jmp 0x406b30
xor eax, eax
mov dword [esp + 0x138], eax
push eax
mov dword [esp + 0x140], eax
mov dword [esp + 0x144], eax
mov dword [esp + 0x148], eax
mov word [esp + 0x13c], 2
call dword [sym.imp.WSOCK32.dll_htonl]
mov ecx, dword [esp + 0x10]
movzx edx, word [ecx + 0xc]
push edx
mov dword [esp + 0x140], eax
call dword [sym.imp.WSOCK32.dll_htons]
mov word [esp + 0x13a], ax
push 0x10
lea eax, [esp + 0x13c]
push eax
push edi
call dword [sym.imp.WSOCK32.dll_bind]
cmp eax, 0xffffffff
jne 0x406b9d
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov edi, eax
push edi
push 0x76
push 0x42e090
call fcn.00405510
add esp, 0xc
test esi, esi
mov dword [esp + 0x1c], 0x7d8
je 0x406b2c
push edi
push 0x76
push ebp
push 0x42e090
call fcn.00405590
mov eax, str.failed
mov edx, ebx
add esp, 0x10
sub edx, eax
jmp 0x406b20
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, 1
test cl, cl
jne 0x406b20
mov edi, dword [esp + 0x18]
push edi
call dword [sym.imp.WSOCK32.dll_closesocket]
mov esi, dword [esp + 0x10]
mov edi, dword [sym.imp.KERNEL32.dll_InterlockedExchange]
push 0
lea edx, [esi + 0x1464]
push edx
call edi
push 0x74
mov ecx, 0x42e090
call fcn.00405430
push 0
lea eax, [esi + 0x1310]
push eax
call edi
mov eax, dword [esi + 0x144c]
test eax, eax
je 0x406b74
push eax
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov eax, dword [esp + 0x1c]
mov dword [esi + 0x144c], 0
mov ecx, dword [esp + 0x35c]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.0040fac6
add esp, 0x350
ret 4
push 0x80
push edi
call dword [sym.imp.WSOCK32.dll_listen]
cmp eax, 0xffffffff
jne 0x406c01
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov edi, eax
push edi
push 0x77
push 0x42e090
call fcn.00405510
add esp, 0xc
test esi, esi
mov dword [esp + 0x1c], 0x7d9
je 0x406b2c
push edi
push 0x77
push ebp
push 0x42e090
call fcn.00405590
mov eax, str.failed
mov edx, ebx
add esp, 0x10
sub edx, eax
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, 1
test cl, cl
jne 0x406bf0
jmp 0x406b2c
test esi, esi
je 0x406ca5
mov ebp, dword [sym.imp.KERNEL32.dll_Sleep]
xor esi, esi
add esi, 1
mov ecx, str.UdpOK
mov eax, ebx
jmp 0x406c20
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x406c40
test dl, dl
je 0x406c3c
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x406c40
add eax, 2
add ecx, 2
test dl, dl
jne 0x406c20
xor eax, eax
jmp 0x406c45
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
je 0x406c87
mov ecx, str.failed
mov eax, ebx
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x406c70
test dl, dl
je 0x406c6c
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x406c70
add eax, 2
add ecx, 2
test dl, dl
jne 0x406c50
xor eax, eax
jmp 0x406c75
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
je 0x406c9c
push 0x1f4
call ebp
cmp esi, 0x14
jl 0x406c11
jmp 0x406c9c
mov eax, 0x421ac0
mov edx, ebx
sub edx, eax
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, 1
test cl, cl
jne 0x406c90
cmp esi, 0x14
je 0x406b30
mov esi, dword [esp + 0x10]
mov ecx, dword [esi + 0xc]
push ecx
push 0x78
push 0x42e090
call fcn.00405510
add esp, 0xc
push 1
lea edx, [esi + 0x1464]
push edx
call dword [sym.imp.KERNEL32.dll_InterlockedExchange]
cmp dword [esi + 0x1310], 0
jne 0x406b30
mov esi, dword [esp + 0x2c]
xor ebp, ebp
mov edi, edi
mov eax, dword [esp + 0x10]
mov ecx, dword [eax + 0x14]
mov ebx, dword [sym.imp.WSOCK32.dll_setsockopt]
lea edx, [esp + 0x34]
push edx
push edi
mov dword [esp + 0x3c], ebp
mov dword [esp + 0x28], ecx
mov dword [esp + 0x2c], ebp
call sub.WSOCK32.dll___WSAFDIsSet
test eax, eax
jne 0x406d2f
mov ecx, dword [esp + 0x34]
cmp ecx, ebp
jbe 0x406d1d
cmp dword [esp + eax*4 + 0x38], edi
je 0x406d1d
add eax, 1
cmp eax, ecx
jb 0x406d10
cmp eax, ecx
jne 0x406d2f
cmp ecx, 0x40
jae 0x406d2f
mov dword [esp + eax*4 + 0x38], edi
add dword [esp + 0x34], 1
lea eax, [esp + 0x20]
push eax
push ebp
push ebp
lea ecx, [esp + 0x40]
push ecx
push ebp
call dword [sym.imp.WSOCK32.dll_select]
cmp eax, ebp
je 0x4070e0
cmp eax, 0xffffffff
je 0x4070e0
lea edx, [esp + 0x34]
push edx
push esi
call sub.WSOCK32.dll___WSAFDIsSet
test eax, eax
je 0x406dad
mov ecx, dword [esp + 0x34]
xor eax, eax
cmp ecx, ebp
jbe 0x406dad
lea esp, [esp]
cmp dword [esp + eax*4 + 0x38], esi
je 0x406d7f
add eax, 1
cmp eax, ecx
jb 0x406d70
jmp 0x406dad
lea edx, [ecx - 1]
cmp eax, edx
jae 0x406da6
jmp 0x406d90
mov ecx, dword [esp + eax*4 + 0x3c]
mov dword [esp + eax*4 + 0x38], ecx
mov ecx, dword [esp + 0x34]
add eax, 1
lea edx, [ecx - 1]
cmp eax, edx
jb 0x406d90
sub ecx, 1
mov dword [esp + 0x34], ecx
cmp esi, 0xffffffff
je 0x406db9
push esi
call dword [sym.imp.WSOCK32.dll_closesocket]
xor eax, eax
mov dword [esp + 0x148], eax
mov dword [esp + 0x14c], eax
mov dword [esp + 0x150], eax
mov dword [esp + 0x154], eax
lea eax, [esp + 0x2c]
push eax
lea ecx, [esp + 0x14c]
push ecx
push edi
mov dword [esp + 0x38], 0x10
call dword [sym.imp.WSOCK32.dll_accept]
mov esi, eax
cmp esi, 0xffffffff
jne 0x406e18
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
push eax
push str.TCP:Accept_Error_code__d_n
push 0x42e090
call fcn.00405490
add esp, 0xc
jmp 0x4070fc
push 1
lea edx, [esp + 0x1b]
push edx
push 0xffffff7f
push 0xffff
push esi
mov byte [esp + 0x2b], 0
call ebx
push 4
lea eax, [esp + 0x2c]
push eax
push 0x80
push 0xffff
push esi
mov word [esp + 0x3c], 1
mov word [esp + 0x3e], bp
call ebx
mov edi, dword [esp + 0x10]
mov ecx, dword [edi + 0x14]
lea edx, [esp + 0x34]
push edx
push esi
mov dword [esp + 0x3c], ebp
mov dword [esp + 0x28], ecx
mov dword [esp + 0x2c], ebp
call sub.WSOCK32.dll___WSAFDIsSet
test eax, eax
jne 0x406e9f
mov ecx, dword [esp + 0x34]
cmp ecx, ebp
jbe 0x406e8d
jmp 0x406e80
cmp dword [esp + eax*4 + 0x38], esi
je 0x406e8d
add eax, 1
cmp eax, ecx
jb 0x406e80
cmp eax, ecx
jne 0x406e9f
cmp ecx, 0x40
jae 0x406e9f
mov dword [esp + eax*4 + 0x38], esi
add dword [esp + 0x34], 1
lea eax, [esp + 0x20]
push eax
push ebp
push ebp
lea ecx, [esp + 0x40]
push ecx
push ebp
call dword [sym.imp.WSOCK32.dll_select]
cmp eax, ebp
je 0x4070d7
cmp eax, 0xffffffff
je 0x4070d7
push 0x200
lea edx, [esp + 0x160]
push 0
push edx
call fcn.0040fd40
add esp, 0xc
push 0
push 0x200
lea eax, [esp + 0x164]
push eax
push esi
call dword [sym.imp.WSOCK32.dll_recv]
mov edi, eax
cmp edi, 0xffffffff
jne 0x406f7f
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
push eax
push 0x8d
push 0x42e090
call fcn.00405510
add esp, 0xc
lea ecx, [esp + 0x34]
push ecx
push esi
call sub.WSOCK32.dll___WSAFDIsSet
test eax, eax
je 0x406f70
mov ecx, dword [esp + 0x34]
xor eax, eax
test ecx, ecx
jbe 0x406f70
lea ecx, [ecx]
cmp dword [esp + eax*4 + 0x38], esi
je 0x406f4c
add eax, 1
cmp eax, ecx
jb 0x406f30
push esi
call dword [sym.imp.WSOCK32.dll_closesocket]
or esi, 0xffffffff
jmp 0x4070fc
lea edx, [ecx - 1]
cmp eax, edx
jae 0x406f69
mov ecx, dword [esp + eax*4 + 0x3c]
mov dword [esp + eax*4 + 0x38], ecx
mov ecx, dword [esp + 0x34]
add eax, 1
lea edx, [ecx - 1]
cmp eax, edx
jb 0x406f53
sub ecx, 1
mov dword [esp + 0x34], ecx
push esi
call dword [sym.imp.WSOCK32.dll_closesocket]
or esi, 0xffffffff
jmp 0x4070fc
mov ebx, dword [esp + 0x10]
cmp dword [ebx + 0x1460], 0
je 0x406fae
mov eax, dword [esp + 0x14c]
push edi
push eax
call dword [sym.imp.WSOCK32.dll_inet_ntoa]
push eax
push str.TCP_Recv_data_ip_s_len_d_n
push 0x42e090
call fcn.00405490
add esp, 0x10
push edi
lea ecx, [esp + 0x14c]
push ecx
mov ecx, ebx
mov word [esp + 0x150], 1
call fcn.004064a0
test eax, eax
je 0x40706d
push 0
push eax
lea edx, [esp + 0x164]
push edx
push esi
call dword [sym.imp.WSOCK32.dll_send]
test eax, eax
je 0x406ff8
cmp dword [ebx + 0x1460], 0
je 0x40706d
push eax
push 0x79
jmp 0x407060
lea eax, [esp + 0x34]
push eax
push esi
call sub.WSOCK32.dll___WSAFDIsSet
test eax, eax
je 0x40704d
mov ecx, dword [esp + 0x34]
xor eax, eax
test ecx, ecx
jbe 0x40704d
cmp dword [esp + eax*4 + 0x38], esi
je 0x407020
add eax, 1
cmp eax, ecx
jb 0x407011
jmp 0x40704d
lea edx, [ecx - 1]
cmp eax, edx
jae 0x407046
jmp 0x407030
mov ecx, dword [esp + eax*4 + 0x3c]
mov dword [esp + eax*4 + 0x38], ecx
mov ecx, dword [esp + 0x34]
add eax, 1
lea edx, [ecx - 1]
cmp eax, edx
jb 0x407030
sub ecx, 1
mov dword [esp + 0x34], ecx
push esi
call dword [sym.imp.WSOCK32.dll_closesocket]
or esi, 0xffffffff
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
push eax
push 0x7a
push 0x42e090
call fcn.00405510
add esp, 0xc
lea eax, [esp + 0x34]
push eax
push esi
call sub.WSOCK32.dll___WSAFDIsSet
test eax, eax
je 0x4070bd
mov ecx, dword [esp + 0x34]
xor eax, eax
test ecx, ecx
jbe 0x4070bd
cmp dword [esp + eax*4 + 0x38], esi
je 0x407095
add eax, 1
cmp eax, ecx
jb 0x407086
jmp 0x4070bd
lea edx, [ecx - 1]
cmp eax, edx
jae 0x4070b6
lea esp, [esp]
mov ecx, dword [esp + eax*4 + 0x3c]
mov dword [esp + eax*4 + 0x38], ecx
mov ecx, dword [esp + 0x34]
add eax, 1
lea edx, [ecx - 1]
cmp eax, edx
jb 0x4070a0
sub ecx, 1
mov dword [esp + 0x34], ecx
push 2
push esi
call dword [sym.imp.WSOCK32.dll_shutdown]
cmp esi, 0xffffffff
je 0x4070fc
push esi
call dword [sym.imp.WSOCK32.dll_closesocket]
or esi, 0xffffffff
jmp 0x4070fc
cmp dword [edi + 0x1460], 4
jmp 0x4070eb
mov eax, dword [esp + 0x10]
cmp dword [eax + 0x1460], 4
jl 0x4070fc
push str.Tcp_Time_out._n
mov ecx, 0x42e090
call fcn.00405380
mov ecx, dword [esp + 0x10]
mov edi, dword [esp + 0x18]
xor ebp, ebp
cmp dword [ecx + 0x1310], ebp
je 0x406ce0
jmp 0x406b30