Function at 0x407fc6
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 0x408013
mov eax, 1
test eax, eax
je 0x407ffc
mov dword [ebp - 0x2c], 0
jmp 0x40800c
push str.Cant_open_stream_socket_n
call fcn.00404590
add esp, 4
mov dword [ebp - 0x2c], eax
xor eax, eax
jmp 0x408275
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 0x4080cd
mov eax, 1
test eax, eax
je 0x4080b6
mov dword [ebp - 0x30], 0
jmp 0x4080c6
push str.Cant_bind_local_address_n
call fcn.00404590
add esp, 4
mov dword [ebp - 0x30], eax
xor eax, eax
jmp 0x408275
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 0x408151
mov edx, 1
test edx, edx
je 0x408132
mov dword [ebp - 0x34], 0
jmp 0x40814a
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.00404590
add esp, 0xc
mov dword [ebp - 0x34], eax
xor eax, eax
jmp 0x408275
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 0x4081d5
mov eax, 1
test eax, eax
je 0x4081b6
mov dword [ebp - 0x38], 0
jmp 0x4081ce
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.00404590
add esp, 0xc
mov dword [ebp - 0x38], eax
xor eax, eax
jmp 0x408275
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 0x40822c
call dword [sym.imp.ws2_32.dll_WSAGetLastError]
mov dword [ebp - 4], eax
mov ecx, 1
test ecx, ecx
je 0x408214
mov dword [ebp - 0x3c], 0
jmp 0x408228
mov edx, dword [ebp - 4]
push edx
push str.Listen_Event_Create_Fail____d__n
call fcn.00404590
add esp, 8
mov dword [ebp - 0x3c], eax
xor eax, eax
jmp 0x408275
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 0x408254
mov dword [ebp - 0x40], 0
jmp 0x408268
mov edx, dword [ebp + 8]
push edx
push str.Port___05d__initialzed_n
call fcn.00404590
add esp, 8
mov dword [ebp - 0x40], eax
mov ecx, dword [ebp - 0x28]
call fcn.00408408
mov eax, 1
mov esp, ebp
pop ebp
ret 4