Function at 0x408341
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Create tcp socket
Resolve dns
Set socket configuration
Start tcp server

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x1c
push ebx
push esi
push edi
mov eax, dword [ebp + 0xc]
shr eax, 0x10
test eax, 0xffff
jne 0x408520
push 6
push 1
push 2
call dword [sym.imp.WSOCK32.dll_socket]
mov dword [ebp - 4], eax
cmp dword [ebp - 4], 0xffffffff
jne 0x40837b
xor eax, eax
jmp 0x40859c
mov word [ebp - 0x18], 2
push dword [ebp + 0xc]
call dword [sym.imp.WSOCK32.dll_htons]
mov word [ebp - 0x16], ax
cmp dword [ebp + 8], 0
jne 0x4083a4
mov dword [ebp - 0x14], 0
jmp 0x40840a
push dword [ebp + 8]
call dword [sym.imp.WSOCK32.dll_inet_addr]
mov dword [ebp - 0x1c], eax
cmp dword [ebp - 0x1c], 0xffffffff
jne 0x408404
push dword [ebp + 8]
call dword [sym.imp.WSOCK32.dll_gethostbyname]
mov dword [ebp - 8], eax
cmp dword [ebp - 8], 0
jne 0x4083f2
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov dword [ebp - 0x1c], eax
push dword [ebp - 4]
call dword [sym.imp.WSOCK32.dll_closesocket]
push dword [ebp - 0x1c]
call dword [sym.imp.WSOCK32.dll_WSASetLastError]
xor eax, eax
jmp 0x40859c
mov eax, dword [ebp - 8]
mov eax, dword [eax + 0xc]
mov eax, dword [eax]
mov eax, dword [eax]
mov dword [ebp - 0x14], eax
jmp 0x40840a
mov eax, dword [ebp - 0x1c]
mov dword [ebp - 0x14], eax
push 0xff
push 0x400
push dword [0x433ef8]
push dword [ebp - 4]
call dword [sym.imp.WSOCK32.dll_WSAAsyncSelect]
cmp eax, 0xffffffff
jne 0x40844e
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov dword [ebp - 0x1c], eax
push dword [ebp - 4]
call dword [sym.imp.WSOCK32.dll_closesocket]
push dword [ebp - 0x1c]
call dword [sym.imp.WSOCK32.dll_WSASetLastError]
xor eax, eax
jmp 0x40859c
cmp dword [ebp + 8], 0
jne 0x4084d0
push 0x10
lea eax, [ebp - 0x18]
push eax
push dword [ebp - 4]
call dword [sym.imp.WSOCK32.dll_bind]
cmp eax, 0xffffffff
jne 0x408492
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov dword [ebp - 0x1c], eax
push dword [ebp - 4]
call dword [sym.imp.WSOCK32.dll_closesocket]
push dword [ebp - 0x1c]
call dword [sym.imp.WSOCK32.dll_WSASetLastError]
xor eax, eax
jmp 0x40859c
push closesocket
push dword [ebp - 4]
call dword [sym.imp.WSOCK32.dll_listen]
cmp eax, 0xffffffff
jne 0x4084cb
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov dword [ebp - 0x1c], eax
push dword [ebp - 4]
call dword [sym.imp.WSOCK32.dll_closesocket]
push dword [ebp - 0x1c]
call dword [sym.imp.WSOCK32.dll_WSASetLastError]
xor eax, eax
jmp 0x40859c
jmp 0x40851b
push 0x10
lea eax, [ebp - 0x18]
push eax
push dword [ebp - 4]
call dword [sym.imp.WSOCK32.dll_connect]
cmp eax, 0xffffffff
jne 0x40851b
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
cmp eax, 0x2733
je 0x40851b
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov dword [ebp - 0x1c], eax
push dword [ebp - 4]
call dword [sym.imp.WSOCK32.dll_closesocket]
push dword [ebp - 0x1c]
call dword [sym.imp.WSOCK32.dll_WSASetLastError]
xor eax, eax
jmp 0x40859c
jmp 0x408594
cmp dword [ebp + 0xc], 0xffffffff
jne 0x408582
push 0
push 0
push dword [ebp + 8]
call dword [sym.imp.WSOCK32.dll_accept]
mov dword [ebp - 4], eax
cmp dword [ebp - 4], 0xffffffff
jne 0x408570
call dword [sym.imp.WSOCK32.dll_WSAGetLastError]
cmp eax, 0x2733
jne 0x408564
mov eax, 0xffffffff
jmp 0x40859c
xor eax, eax
jmp 0x40859c
push 0x80000
push dword [ebp + 8]
call fcn.00422f47
jmp 0x408594
push 0x2710
call dword [sym.imp.WSOCK32.dll_WSASetLastError]
xor eax, eax
jmp 0x40859c
mov eax, dword [ebp - 4]
jmp 0x40859c
pop edi
pop esi
pop ebx
leave
ret 8