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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x40
mov dword [ebp - 0x28], ecx
push 0
push 1
push 2
call dword [sym.imp.ws2_32.dll_socket]
mov ecx, dword [ebp - 0x28]
mov dword [ecx + 4], eax
mov edx, dword [ebp - 0x28]
cmp dword [edx + 4], 0
jae 0x408063
mov eax, 1
test eax, eax
je 0x40804c
mov dword [ebp - 0x2c], 0
jmp 0x40805c
push str.Cant_open_stream_socket_n
call fcn.004045e0
add esp, 4
mov dword [ebp - 0x2c], eax
xor eax, eax
jmp 0x4082c5
push 0x10
push 0
lea ecx, [ebp - 0x1c]
push ecx
call sub.msvcrt.dll_memset
add esp, 0xc
mov word [ebp - 0x1c], 2
push 0
call dword [sym.imp.ws2_32.dll_htonl]
mov dword [ebp - 0x18], eax
mov dx, word [ebp + 8]
push edx
call dword [sym.imp.ws2_32.dll_htons]
mov word [ebp - 0x1a], ax
mov dword [ebp - 0x24], 1
push 4
lea eax, [ebp - 0x24]
push eax
push 4
push 0xffff
mov ecx, dword [ebp - 0x28]
mov edx, dword [ecx + 4]
push edx
call dword [sym.imp.ws2_32.dll_setsockopt]
mov word [ebp - 0x20], 0
mov word [ebp - 0x1e], 0
push 4
lea eax, [ebp - 0x20]
push eax
push 0x80
push 0xffff
mov ecx, dword [ebp - 0x28]
mov edx, dword [ecx + 4]
push edx
call dword [sym.imp.ws2_32.dll_setsockopt]
push 0x10
lea eax, [ebp - 0x1c]
push eax
mov ecx, dword [ebp - 0x28]
mov edx, dword [ecx + 4]
push edx
call dword [sym.imp.ws2_32.dll_bind]
test eax, eax
jge 0x40811d
mov eax, 1
test eax, eax
je 0x408106
mov dword [ebp - 0x30], 0
jmp 0x408116
push str.Cant_bind_local_address_n
call fcn.004045e0
add esp, 4
mov dword [ebp - 0x30], eax
xor eax, eax
jmp 0x4082c5
mov dword [ebp - 8], 0x10000
push 4
lea ecx, [ebp - 8]
push ecx
push 0x1002
push 0xffff
mov edx, dword [ebp - 0x28]
mov eax, dword [edx + 4]
push eax
call dword [sym.imp.ws2_32.dll_setsockopt]
mov dword [ebp - 0xc], 4
lea ecx, [ebp - 0xc]
push ecx
lea edx, [ebp - 8]
push edx
push 0x1002
push 0xffff
mov eax, dword [ebp - 0x28]
mov ecx, dword [eax + 4]
push ecx
call dword [sym.imp.ws2_32.dll_getsockopt]
mov dword [ebp - 4], eax
cmp dword [ebp - 4], 0xffffffff
jne 0x4081a1
mov edx, 1
test edx, edx
je 0x408182
mov dword [ebp - 0x34], 0
jmp 0x40819a
mov eax, dword [ebp - 8]
push eax
mov ecx, dword [ebp + 8]
push ecx
push str.FAIL_:_Set_Socket_RecvBuf_of_port__d__as__d_n
call fcn.004045e0
add esp, 0xc
mov dword [ebp - 0x34], eax
xor eax, eax
jmp 0x4082c5
mov dword [ebp - 8], 0x10000
push 4
lea edx, [ebp - 8]
push edx
push 0x1001
push 0xffff
mov eax, dword [ebp - 0x28]
mov ecx, dword [eax + 4]
push ecx
call dword [sym.imp.ws2_32.dll_setsockopt]
mov dword [ebp - 0xc], 4
lea edx, [ebp - 0xc]
push edx
lea eax, [ebp - 8]
push eax
push 0x1001
push 0xffff
mov ecx, dword [ebp - 0x28]
mov edx, dword [ecx + 4]
push edx
call dword [sym.imp.ws2_32.dll_getsockopt]
mov dword [ebp - 4], eax
cmp dword [ebp - 4], 0xffffffff
jne 0x408225
mov eax, 1
test eax, eax
je 0x408206
mov dword [ebp - 0x38], 0
jmp 0x40821e
mov ecx, dword [ebp - 8]
push ecx
mov edx, dword [ebp + 8]
push edx
push str.FAIL:_Set_Socket_SendBuf_of_port__d__as__d_n
call fcn.004045e0
add esp, 0xc
mov dword [ebp - 0x38], eax
xor eax, eax
jmp 0x4082c5
push 5
mov eax, dword [ebp - 0x28]
mov ecx, dword [eax + 4]
push ecx
call dword [sym.imp.ws2_32.dll_listen]
call dword [sym.imp.ws2_32.dll_WSACreateEvent]
mov edx, dword [ebp - 0x28]
mov dword [edx + 8], eax
mov eax, dword [ebp - 0x28]
cmp dword [eax + 8], 0
jne 0x40827c
call dword [sym.imp.ws2_32.dll_WSAGetLastError]
mov dword [ebp - 4], eax
mov ecx, 1
test ecx, ecx
je 0x408264
mov dword [ebp - 0x3c], 0
jmp 0x408278
mov edx, dword [ebp - 4]
push edx
push str.Listen_Event_Create_Fail____d__n
call fcn.004045e0
add esp, 8
mov dword [ebp - 0x3c], eax
xor eax, eax
jmp 0x4082c5
push 8
mov eax, dword [ebp - 0x28]
mov ecx, dword [eax + 8]
push ecx
mov edx, dword [ebp - 0x28]
mov eax, dword [edx + 4]
push eax
call dword [sym.imp.ws2_32.dll_WSAEventSelect]
mov ecx, 1
test ecx, ecx
je 0x4082a4
mov dword [ebp - 0x40], 0
jmp 0x4082b8
mov edx, dword [ebp + 8]
push edx
push str.Port___05d__initialzed_n
call fcn.004045e0
add esp, 8
mov dword [ebp - 0x40], eax
mov ecx, dword [ebp - 0x28]
call fcn.00408458
mov eax, 1
mov esp, ebp
pop ebp
ret 4