Function at 0x408766
Capabilities:
Create tcp socket
Create udp socket
Set socket configuration

Disassembly:
push ebp
mov ebp, esp
push ebx
sub esp, 0x184
mov dword [ebp - 0xc], str.internal_error
mov ebx, dword [ebp + 8]
mov dword [esp + 8], 0
mov dword [esp + 4], 2
mov dword [esp], 2
call sub.WS2_32.DLL_socket
sub esp, 0xc
mov dword [ebx + 4], eax
mov eax, dword [ebp + 8]
mov dword [eax + 0x44], 0
mov eax, dword [ebp + 8]
mov dword [eax + 0x40], 0
mov dword [ebp - 0x10], 1
mov dword [esp + 0x10], 4
lea eax, [ebp - 0x10]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x20
mov dword [esp + 4], 0xffff
mov eax, dword [ebp + 8]
mov eax, dword [eax + 4]
mov dword [esp], eax
call sub.WS2_32.DLL_setsockopt
sub esp, 0x14
test eax, eax
je 0x4087fc
mov dword [esp], str.setsockopt
call sub.msvcrt.dll_perror
jmp 0x4089ac
mov dword [esp + 8], 0x10
mov dword [esp + 4], 0
lea eax, [ebp - 0x28]
mov dword [esp], eax
call sub.msvcrt.dll_memset
mov word [ebp - 0x28], 2
mov dword [ebp - 0x24], 0
mov word [ebp - 0x26], 0
mov dword [esp + 8], 0x10
lea eax, [ebp - 0x28]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov eax, dword [eax + 4]
mov dword [esp], eax
call sub.WS2_32.DLL_bind
sub esp, 0xc
cmp eax, 0xffffffff
jne 0x408860
mov dword [esp], 0x418a42
call sub.msvcrt.dll_perror
jmp 0x4089ac
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.00408558
mov ebx, dword [ebp + 8]
mov dword [esp], 0
call sub.msvcrt.dll_time
and eax, 0xffff
mov dword [ebx + 0x48], eax
mov dword [ebp - 0x2c], 0
cmp dword [ebp - 0x2c], 2
ja 0x4089a5
mov dword [ebp - 0x30], 0
mov eax, dword [ebp + 8]
mov eax, dword [eax + 0x4c]
cmp eax, dword [ebp - 0x30]
jbe 0x40899b
mov dword [ebp - 0x34], 0x64
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x20
mov dword [esp], eax
call sub.msvcrt.dll_fflush
mov eax, dword [ebp - 0x30]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0040820e
test al, al
jne 0x408910
call sub.WS2_32.DLL_WSAGetLastError
mov dword [esp + 4], eax
mov dword [esp], str.sendto_error__d_n
call sub.msvcrt.dll_printf
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x20
mov dword [esp], eax
call sub.msvcrt.dll_fflush
jmp 0x4089ac
mov eax, dword [ebp - 0x30]
mov dword [esp + 0x14], eax
lea eax, [ebp - 0x34]
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], 2
mov dword [esp + 8], 0x16
lea eax, [ebp - 0x58]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0040825a
test eax, eax
js 0x408991
cmp dword [ebp - 0x46], 0
jne 0x408991
cmp dword [ebp - 0x30], 0
je 0x40897b
mov dword [esp + 8], 6
mov edx, dword [ebp - 0x30]
mov eax, edx
add eax, eax
add eax, edx
add eax, eax
add eax, dword [ebp + 8]
add eax, 8
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
add eax, 8
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
mov eax, dword [ebp + 8]
mov dword [eax + 0x4c], 1
mov dword [ebp - 0x15c], 1
jmp 0x408a0c
lea eax, [ebp - 0x30]
inc dword [eax]
jmp 0x40889a
lea eax, [ebp - 0x2c]
inc dword [eax]
jmp 0x408889
mov dword [ebp - 0xc], str.timed_out
mov eax, dword [ebp + 8]
add eax, 0x38
mov dword [esp], eax
call fcn.00409338
mov edx, eax
mov eax, dword [ebp - 0xc]
mov dword [esp + 0x14], eax
mov dword [esp + 0x10], 0x5051
mov dword [esp + 0xc], edx
mov dword [esp + 8], str.Could_not_connect_to__s__port__u_____s_
mov dword [esp + 4], 0x100
lea eax, [ebp - 0x158]
mov dword [esp], eax
call fcn.00412230
lea eax, [ebp - 0x158]
mov dword [esp + 4], eax
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
call fcn.00406782
mov dword [ebp - 0x15c], 0
mov eax, dword [ebp - 0x15c]
mov ebx, dword [ebp - 4]
leave
ret