Function at 0x409040
Capabilities:
Create tcp socket
Create udp socket
Get hostname
Initialize winsock library
Receive data
Receive data on socket
Resolve dns
Send data
Send data on socket
Set socket configuration
Start tcp server

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x4e8
mov dword [ebp - 0x1a0], 0
mov dword [ebp - 0x4c8], 0
mov dword [ebp - 0x3bc], 0
mov dword [ebp - 0x4c4], 0
mov dword [ebp - 0x4d4], 0
mov dword [ebp - 0x2b0], 0
mov dword [ebp - 0x2ac], 0
mov dword [ebp - 0x4d8], 0
mov byte [ebp - 0x3b8], 0
mov dword [ebp - 4], 0
jmp 0x4090b2
mov eax, dword [ebp - 4]
add eax, 1
mov dword [ebp - 4], eax
mov ecx, dword [ebp - 4]
cmp ecx, dword [ebp + 8]
jge 0x409264
push 0x41a9e8
mov edx, dword [ebp - 4]
mov eax, dword [ebp + 0xc]
mov ecx, dword [eax + edx*4]
push ecx
call fcn.0040b749
add esp, 8
test eax, eax
je 0x40912a
push str._wait
mov edx, dword [ebp - 4]
mov eax, dword [ebp + 0xc]
mov ecx, dword [eax + edx*4]
push ecx
call fcn.0040b749
add esp, 8
test eax, eax
je 0x40912a
push 0x41a9f8
mov edx, dword [ebp - 4]
mov eax, dword [ebp + 0xc]
mov ecx, dword [eax + edx*4]
push ecx
call fcn.0040b749
add esp, 8
test eax, eax
je 0x40912a
push 0x41a9fc
mov edx, dword [ebp - 4]
mov eax, dword [ebp + 0xc]
mov ecx, dword [eax + edx*4]
push ecx
call fcn.0040b749
add esp, 8
test eax, eax
jne 0x40915c
mov edx, dword [ebp - 4]
add edx, 1
cmp dword [ebp + 8], edx
jle 0x40915c
mov eax, dword [ebp - 4]
add eax, 1
mov dword [ebp - 4], eax
mov ecx, dword [ebp - 4]
mov edx, dword [ebp + 0xc]
mov eax, dword [edx + ecx*4]
push eax
call fcn.0040ae83
add esp, 4
mov word [ebp - 0x19c], ax
jmp 0x4090a9
push 0x41aa00
mov ecx, dword [ebp - 4]
mov edx, dword [ebp + 0xc]
mov eax, dword [edx + ecx*4]
push eax
call fcn.0040b749
add esp, 8
test eax, eax
je 0x409192
push str._out
mov ecx, dword [ebp - 4]
mov edx, dword [ebp + 0xc]
mov eax, dword [edx + ecx*4]
push eax
call fcn.0040b749
add esp, 8
test eax, eax
jne 0x4091c4
mov ecx, dword [ebp - 4]
add ecx, 1
cmp dword [ebp + 8], ecx
jle 0x4091c4
mov edx, dword [ebp - 4]
add edx, 1
mov dword [ebp - 4], edx
mov eax, dword [ebp - 4]
mov ecx, dword [ebp + 0xc]
mov edx, dword [ecx + eax*4]
push edx
lea eax, [ebp - 0x3b8]
push eax
call fcn.00409de0
add esp, 8
jmp 0x4090a9
push 0x41aa10
mov ecx, dword [ebp - 4]
mov edx, dword [ebp + 0xc]
mov eax, dword [edx + ecx*4]
push eax
call fcn.0040b749
add esp, 8
test eax, eax
je 0x4091fa
push str._nostdout
mov ecx, dword [ebp - 4]
mov edx, dword [ebp + 0xc]
mov eax, dword [edx + ecx*4]
push eax
call fcn.0040b749
add esp, 8
test eax, eax
jne 0x409209
mov dword [ebp - 0x2ac], 1
jmp 0x4090a9
push 0x41aa28
mov ecx, dword [ebp - 4]
mov edx, dword [ebp + 0xc]
mov eax, dword [edx + ecx*4]
push eax
call fcn.0040b749
add esp, 8
test eax, eax
je 0x40923f
push str._dprint
mov ecx, dword [ebp - 4]
mov edx, dword [ebp + 0xc]
mov eax, dword [edx + ecx*4]
push eax
call fcn.0040b749
add esp, 8
test eax, eax
jne 0x40925f
cmp dword [0x41b828], 0
jne 0x40925f
push 0x418040
call fcn.00407e60
add esp, 4
mov dword [0x41b828], 2
jmp 0x4090a9
push 0x10
push 0
push 0x41b810
call fcn.0040c120
add esp, 0xc
mov word [ebp - 0x4cc], 0x202
lea ecx, [ebp - 0x198]
push ecx
mov dx, word [ebp - 0x4cc]
push edx
call dword [sym.imp.WS2_32.dll_WSAStartup]
test eax, eax
je 0x40929c
jmp 0x409a13
movzx eax, word [ebp - 0x198]
and eax, 0xff
movzx ecx, al
cmp ecx, 2
jl 0x4092d7
movzx edx, word [ebp - 0x198]
and edx, 0xff
movzx eax, dl
cmp eax, 2
jne 0x4092e2
movzx ecx, word [ebp - 0x198]
shr ecx, 8
movzx edx, cl
cmp edx, 2
jge 0x4092e2
call dword [sym.imp.WS2_32.dll_WSACleanup]
jmp 0x409a13
push 0x100
lea eax, [ebp - 0x4c0]
push eax
call dword [sym.imp.WS2_32.dll_gethostname]
test eax, eax
jge 0x40930a
push str.Error:_Unable_to_get_hostname_n
call fcn.0040b718
add esp, 4
jmp 0x409a13
lea ecx, [ebp - 0x4c0]
push ecx
call dword [sym.imp.WS2_32.dll_gethostbyname]
mov dword [ebp - 0x4d4], eax
cmp dword [ebp - 0x4d4], 0
jne 0x409338
push str.Error:_Unable_to_get_host_address_n
call fcn.0040b718
add esp, 4
jmp 0x409a13
mov edx, dword [ebp - 0x4d4]
movsx eax, word [edx + 0xa]
push eax
mov ecx, dword [ebp - 0x4d4]
mov edx, dword [ecx + 0xc]
mov eax, dword [edx]
push eax
push 0x41b814
call fcn.0040bd60
add esp, 0xc
mov word [0x41b810], 2
mov cx, word [ebp - 0x19c]
push ecx
call dword [sym.imp.WS2_32.dll_htons]
mov word [0x41b812], ax
push 0
push 1
push 2
call dword [sym.imp.WS2_32.dll_socket]
mov dword [0x41b820], eax
cmp dword [0x41b820], 0
jge 0x4093a5
push str.Error:_Unable_to_create_socket_n
call fcn.0040b718
add esp, 4
jmp 0x409a13
push 0x10
push 0x41b810
mov edx, dword [0x41b820]
push edx
call dword [sym.imp.WS2_32.dll_bind]
test eax, eax
jge 0x4093d4
movzx eax, word [ebp - 0x19c]
push eax
push str.Unable_to_bind_to_socket_on_port__d_n
call fcn.0040b718
add esp, 8
jmp 0x4093de
mov dword [ebp - 0x2a4], 1
cmp dword [ebp - 0x2a4], 0
je 0x409405
cmp dword [0x41b828], 0
je 0x409405
movzx ecx, word [ebp - 0x19c]
push ecx
push str.Message:_Bound_socket_to_port__d_n
call fcn.0040b718
add esp, 8
cmp dword [ebp - 0x2a4], 0
jne 0x409436
cmp dword [0x41b828], 0
je 0x409424
push str.Error:_Unable_to_bind_socket_n
call fcn.0040b718
add esp, 4
mov edx, dword [0x41b820]
push edx
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x409a13
push 5
mov eax, dword [0x41b820]
push eax
call dword [sym.imp.WS2_32.dll_listen]
test eax, eax
je 0x409470
cmp dword [0x41b828], 0
je 0x40945e
push str.Error:_Unable_to_listen_on_socket_n
call fcn.0040b718
add esp, 4
mov ecx, dword [0x41b820]
push ecx
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x409a13
mov dword [ebp - 0x2b4], 0x10
mov edx, dword [ebp - 0x2b4]
push edx
push 0
push 0x41b800
call fcn.0040c120
add esp, 0xc
cmp dword [0x41b828], 0
je 0x4094ae
movzx eax, word [ebp - 0x19c]
push eax
push str.Waiting_for_data_on_port__d_..._n
call fcn.0040b718
add esp, 8
lea ecx, [ebp - 0x2b4]
push ecx
push 0x41b800
mov edx, dword [0x41b820]
push edx
call dword [sym.imp.WS2_32.dll_accept]
mov dword [0x41b824], eax
cmp dword [0x41b828], 0
je 0x4094e2
push str.Accepted_incoming_message_n
call fcn.0040b718
add esp, 4
cmp dword [0x41b824], 0
jge 0x40951f
cmp dword [0x41b828], 0
je 0x409501
push str.Error:_Unable_to_accept_on_socket_n
call fcn.0040b718
add esp, 4
mov eax, dword [0x41b820]
push eax
call dword [sym.imp.WS2_32.dll_closesocket]
mov ecx, dword [0x41b824]
push ecx
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x409a13
mov dword [ebp - 0x4d0], 0x1388
mov edx, dword [ebp - 0x4d0]
push edx
call fcn.0040b094
add esp, 4
mov dword [ebp - 0x4c4], eax
cmp dword [ebp - 0x4c4], 0
jne 0x409565
mov eax, dword [0x41b820]
push eax
call dword [sym.imp.WS2_32.dll_closesocket]
mov ecx, dword [0x41b824]
push ecx
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x409a13
mov edx, dword [ebp - 0x4d0]
push edx
push 0
mov eax, dword [ebp - 0x4c4]
push eax
call fcn.0040c120
add esp, 0xc
cmp dword [0x41b828], 0
je 0x409593
push str.Setting_socket_to_non_blocking._n
call fcn.0040b718
add esp, 4
mov dword [ebp - 0x4e0], 1
lea ecx, [ebp - 0x4e0]
push ecx
push 0x8004667e
mov edx, dword [0x41b824]
push edx
call dword [sym.imp.WS2_32.dll_ioctlsocket]
mov dword [ebp - 0x4e4], 0
mov eax, 1
test eax, eax
je 0x4096b4
mov ecx, dword [ebp - 0x4e4]
add ecx, 1
mov dword [ebp - 0x4e4], ecx
cmp dword [0x41b828], 0
je 0x4095f2
push str.Message_:_Checking_for_data_from_client._n
call fcn.0040b718
add esp, 4
push 2
mov edx, dword [ebp - 0x4d0]
push edx
mov eax, dword [ebp - 0x4c4]
push eax
mov ecx, dword [0x41b824]
push ecx
call dword [sym.imp.WS2_32.dll_recv]
mov dword [ebp - 0x4dc], eax
cmp dword [ebp - 0x4dc], 0
jge 0x4096b4
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov dword [ebp - 0x4e8], eax
cmp dword [0x41b828], 0
je 0x409644
push str.Message_:_No_data_from_client._n
call fcn.0040b718
add esp, 4
cmp dword [0x41b828], 0
je 0x409661
mov edx, dword [ebp - 0x4e8]
push edx
push str.Error:_recv_returned_error___d_n
call fcn.0040b718
add esp, 8
cmp dword [0x41b828], 0
je 0x409677
push str.Error:_Unable_to_receive_data._n
call fcn.0040b718
add esp, 4
cmp dword [ebp - 0x4e4], 0
je 0x409688
push 0x64
call dword [sym.imp.KERNEL32.dll_Sleep]
cmp dword [ebp - 0x4e4], 0xa
jge 0x409696
jmp 0x4095c0
mov eax, dword [0x41b820]
push eax
call dword [sym.imp.WS2_32.dll_closesocket]
mov ecx, dword [0x41b824]
push ecx
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x409a13
cmp dword [0x41b828], 0
je 0x4096ca
push str.Message_:_Found_data_from_client._n
call fcn.0040b718
add esp, 4
cmp dword [0x41b828], 0
je 0x4096e0
push str.Setting_socket_to_blocking._n
call fcn.0040b718
add esp, 4
mov dword [ebp - 0x4e0], 0
lea edx, [ebp - 0x4e0]
push edx
push 0x8004667e
mov eax, dword [0x41b824]
push eax
call dword [sym.imp.WS2_32.dll_ioctlsocket]
cmp dword [0x41b828], 0
je 0x409718
push str.Receiving_data_..._n
call fcn.0040b718
add esp, 4
push 0
mov ecx, dword [ebp - 0x4d0]
push ecx
mov edx, dword [ebp - 0x4c4]
push edx
mov eax, dword [0x41b824]
push eax
call dword [sym.imp.WS2_32.dll_recv]
mov dword [ebp - 0x4dc], eax
mov ecx, dword [ebp - 0x4dc]
cmp ecx, dword [ebp - 0x4d0]
jle 0x4097d9
mov edx, dword [ebp - 0x4dc]
add edx, 1
mov dword [ebp - 0x4d0], edx
mov eax, dword [ebp - 0x4d0]
push eax
mov ecx, dword [ebp - 0x4c4]
push ecx
call fcn.0040aec0
add esp, 8
mov dword [ebp - 0x4c4], eax
cmp dword [ebp - 0x4c4], 0
jne 0x40979e
mov edx, dword [0x41b820]
push edx
call dword [sym.imp.WS2_32.dll_closesocket]
mov eax, dword [0x41b824]
push eax
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x409a13
mov ecx, dword [ebp - 0x4d0]
push ecx
push 0
mov edx, dword [ebp - 0x4c4]
push edx
call fcn.0040c120
add esp, 0xc
push 0
mov eax, dword [ebp - 0x4d0]
push eax
mov ecx, dword [ebp - 0x4c4]
push ecx
mov edx, dword [0x41b824]
push edx
call dword [sym.imp.WS2_32.dll_recv]
mov dword [ebp - 0x4dc], eax
cmp dword [0x41b828], 0
je 0x4097f6
mov eax, dword [ebp - 0x4dc]
push eax
push str.Received__d_bytes_of_data_from_VX_n
call fcn.0040b718
add esp, 8
cmp dword [ebp - 0x4dc], 0
jg 0x409834
cmp dword [0x41b828], 0
je 0x409815
push str.No_data_received_from_VX_n
call fcn.0040b718
add esp, 4
mov ecx, dword [0x41b820]
push ecx
call dword [sym.imp.WS2_32.dll_closesocket]
mov edx, dword [0x41b824]
push edx
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x409a13
cmp dword [0x41b828], 0
je 0x409851
mov eax, dword [ebp - 0x4c4]
push eax
push 0x41acdc
call fcn.0040b718
add esp, 8
mov ecx, dword [ebp - 0x4c4]
add ecx, dword [ebp - 0x4dc]
mov byte [ecx], 0
push 0x41acec
lea edx, [ebp - 0x2a0]
push edx
call fcn.00409de0
add esp, 8
lea eax, [ebp - 0x2a0]
push eax
call fcn.0040ada0
add esp, 4
mov dword [ebp - 0x2a8], eax
cmp dword [0x41b828], 0
je 0x4098a6
mov ecx, dword [ebp - 0x2a8]
push ecx
push str.Sending__d_bytes_of_data_to_the_client_..._n
call fcn.0040b718
add esp, 8
cmp dword [0x41b828], 0
je 0x4098c3
lea edx, [ebp - 0x2a0]
push edx
push str.Buffer___s_n
call fcn.0040b718
add esp, 8
push 0
mov eax, dword [ebp - 0x2a8]
push eax
lea ecx, [ebp - 0x2a0]
push ecx
mov edx, dword [0x41b824]
push edx
call dword [sym.imp.WS2_32.dll_send]
test eax, eax
jg 0x409918
cmp dword [0x41b828], 0
je 0x4098fa
push str._nError:_Unable_to_write_to_socket_n
call fcn.0040b718
add esp, 4
mov eax, dword [0x41b820]
push eax
call dword [sym.imp.WS2_32.dll_closesocket]
mov ecx, dword [0x41b824]
push ecx
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x409a13
cmp dword [0x41b828], 0
je 0x40992e
push str.Done_n
call fcn.0040b718
add esp, 4
mov edx, dword [0x41b820]
push edx
call dword [sym.imp.WS2_32.dll_closesocket]
mov eax, dword [0x41b824]
push eax
call dword [sym.imp.WS2_32.dll_closesocket]
cmp dword [ebp - 0x2ac], 0
jne 0x40997a
cmp dword [0x41b828], 0
je 0x409966
push str.Message_from_VX:_n
call fcn.0040b718
add esp, 4
mov ecx, dword [ebp - 0x4c4]
push ecx
push 0x41ad6c
call fcn.0040b718
add esp, 8
movsx edx, byte [ebp - 0x3b8]
test edx, edx
je 0x4099f1
cmp dword [0x41b828], 0
je 0x4099a2
lea eax, [ebp - 0x3b8]
push eax
push str.Writing_message_to_output_file__s_n
call fcn.0040b718
add esp, 8
push 0x41ad94
lea ecx, [ebp - 0x3b8]
push ecx
call fcn.0040b705
add esp, 8
mov dword [ebp - 0x2b0], eax
cmp dword [ebp - 0x2b0], 0
jne 0x4099c7
jmp 0x409a13
mov edx, dword [ebp - 0x4c4]
push edx
push 0x41ad98
mov eax, dword [ebp - 0x2b0]
push eax
call fcn.0040b52e
add esp, 0xc
mov ecx, dword [ebp - 0x2b0]
push ecx
call fcn.0040b685
add esp, 4
call dword [sym.imp.WS2_32.dll_WSACleanup]
cmp dword [ebp - 0x4c4], 0
je 0x409a0f
mov edx, dword [ebp - 0x4c4]
push edx
call fcn.0040ae88
add esp, 4
xor eax, eax
jmp 0x409a36
call dword [sym.imp.WS2_32.dll_WSACleanup]
cmp dword [ebp - 0x4c4], 0
je 0x409a31
mov eax, dword [ebp - 0x4c4]
push eax
call fcn.0040ae88
add esp, 4
mov eax, 1
mov esp, ebp
pop ebp
ret