Function at 0x408270
Capabilities:
Create tcp socket
Create udp socket
Get socket status
Receive data
Receive data on socket
Send data
Send data on socket
Start tcp server

Disassembly:
sub esp, 0x340
push ebx
push ebp
push esi
mov esi, dword [esp + 0x350]
push edi
push 0
push 1
mov dword [esp + 0x18], ecx
push 2
mov dword [esp + 0x20], 0
lea ebx, [esi + 0x400]
lea ebp, [esi + 0x800]
call sub.WSOCK32.dll_socket
mov edi, eax
cmp edi, 0xffffffff
mov dword [esp + 0x18], edi
jne 0x408387
call sub.WSOCK32.dll_WSAGetLastError
mov edi, eax
cmp edi, 0x273f
jne 0x4082e0
push 0x95
mov ecx, 0x424040
call fcn.004069e0
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x340
ret 4
push edi
push 0x75
push 0x424040
call fcn.00406a60
add esp, 0xc
test esi, esi
je 0x408327
push edi
push 0x75
push ebp
push 0x424040
call fcn.00406ac0
mov edi, 0x417368
or ecx, 0xffffffff
xor eax, eax
add esp, 0x10
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, ebx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov edx, dword [esp + 0x18]
push edx
call sub.WSOCK32.dll_closesocket
mov esi, dword [esp + 0x10]
mov edi, dword [sym.imp.KERNEL32.dll_InterlockedExchange]
push 0
lea eax, [esi + 0x1438]
push eax
call edi
push 0x74
mov ecx, 0x424040
call fcn.004069e0
push 0
push 0x424064
call edi
mov eax, dword [esi + 0x1420]
test eax, eax
je 0x40836c
push eax
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov eax, dword [esp + 0x14]
mov dword [esi + 0x1420], 0
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x340
ret 4
xor ecx, ecx
mov dword [esp + 0x20], ecx
mov word [esp + 0x20], 2
mov dword [esp + 0x24], ecx
mov dword [esp + 0x28], ecx
push ecx
mov dword [esp + 0x30], ecx
call sub.WSOCK32.dll_htonl
mov edx, dword [esp + 0x10]
mov dword [esp + 0x24], eax
mov ax, word [edx + 8]
push eax
call sub.WSOCK32.dll_htons
lea ecx, [esp + 0x20]
push 0x10
push ecx
push edi
mov word [esp + 0x2e], ax
call sub.WSOCK32.dll_bind
test eax, eax
je 0x408428
call sub.WSOCK32.dll_WSAGetLastError
mov edi, eax
push edi
push 0x76
push 0x424040
call fcn.00406a60
add esp, 0xc
mov dword [esp + 0x14], 0x7d8
test esi, esi
je 0x408327
push edi
push 0x76
push ebp
push 0x424040
call fcn.00406ac0
mov edi, 0x417368
or ecx, 0xffffffff
xor eax, eax
add esp, 0x10
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov edx, ecx
mov esi, edi
mov edi, ebx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
jmp 0x408322
push 0xa
push edi
call sub.WSOCK32.dll_listen
cmp eax, 0xffffffff
jne 0x408464
call sub.WSOCK32.dll_WSAGetLastError
mov edi, eax
push edi
push 0x77
push 0x424040
call fcn.00406a60
add esp, 0xc
mov dword [esp + 0x14], 0x7d9
test esi, esi
je 0x408327
push edi
push 0x77
jmp 0x4082f7
test esi, esi
je 0x408516
mov edi, dword [sym.imp.KERNEL32.dll_Sleep]
xor ebp, ebp
inc ebp
mov esi, str.UdpOK
mov eax, ebx
mov dl, byte [eax]
mov cl, dl
cmp dl, byte [esi]
jne 0x4084a0
test cl, cl
je 0x40849c
mov dl, byte [eax + 1]
mov cl, dl
cmp dl, byte [esi + 1]
jne 0x4084a0
add eax, 2
add esi, 2
test cl, cl
jne 0x40847c
xor eax, eax
jmp 0x4084a5
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
je 0x4084eb
mov esi, 0x417368
mov eax, ebx
mov dl, byte [eax]
mov cl, dl
cmp dl, byte [esi]
jne 0x4084d4
test cl, cl
je 0x4084d0
mov dl, byte [eax + 1]
mov cl, dl
cmp dl, byte [esi + 1]
jne 0x4084d4
add eax, 2
add esi, 2
test cl, cl
jne 0x4084b0
xor eax, eax
jmp 0x4084d9
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
je 0x40850d
push 0x1f4
call edi
cmp ebp, 0x14
jl 0x408474
jmp 0x40850d
mov edi, 0x417370
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, ebx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
cmp ebp, 0x14
je 0x408327
mov esi, dword [esp + 0x10]
mov ecx, dword [esi + 8]
push ecx
push 0x78
push 0x424040
call fcn.00406a60
add esp, 0xc
add esi, 0x1438
push 1
push esi
call dword [sym.imp.KERNEL32.dll_InterlockedExchange]
mov ebp, 4
mov eax, dword [0x424064]
test eax, eax
jne 0x408327
mov edi, dword [esp + 0x10]
mov esi, dword [esp + 0x18]
lea eax, [esp + 0x30]
lea ecx, [esp + 0x38]
mov edx, dword [edi + 0x10]
push eax
push 0
push 0
push ecx
push 0
mov dword [esp + 0x50], esi
mov dword [esp + 0x4c], 1
mov dword [esp + 0x44], edx
mov dword [esp + 0x48], 0
mov dword [esp + 0x30], 0x10
call sub.WSOCK32.dll_select
test eax, eax
je 0x408685
cmp eax, 0xffffffff
je 0x408685
lea edx, [esp + 0x1c]
lea eax, [esp + 0x13c]
push edx
push eax
push esi
call sub.WSOCK32.dll_accept
mov edi, eax
cmp edi, 0xffffffff
jne 0x4085d6
call sub.WSOCK32.dll_WSAGetLastError
push eax
push str.TCP:Accept_Error_code__d_n
push 0x424040
call fcn.00406a20
add esp, 0xc
jmp 0x408541
push 0
lea ecx, [esp + 0x154]
push 0x200
push ecx
push edi
call sub.WSOCK32.dll_recv
mov esi, eax
cmp esi, 0xffffffff
jne 0x4085fd
push edi
call sub.WSOCK32.dll_closesocket
jmp 0x408541
mov ebx, dword [esp + 0x10]
mov eax, dword [ebx + 0x1434]
test eax, eax
je 0x40862c
mov edx, dword [esp + 0x140]
push esi
push edx
call sub.WSOCK32.dll_inet_ntoa
push eax
push 0x419e88
push 0x424040
call fcn.00406a20
add esp, 0x10
lea eax, [esp + 0x13c]
push esi
push eax
call fcn.00409a50
add esp, 8
test eax, eax
je 0x40867a
push 0
lea ecx, [esp + 0x154]
push eax
push ecx
push edi
call sub.WSOCK32.dll_send
test eax, eax
je 0x408665
mov ecx, dword [ebx + 0x1434]
test ecx, ecx
je 0x40867a
push eax
push 0x79
jmp 0x40866d
call sub.WSOCK32.dll_WSAGetLastError
push eax
push 0x7a
push 0x424040
call fcn.00406a60
add esp, 0xc
push edi
call sub.WSOCK32.dll_closesocket
jmp 0x408541
cmp dword [edi + 0x1434], ebp
jl 0x408541
push str.Tcp_Time_out._n
mov ecx, 0x424040
call fcn.00406940
jmp 0x408541