Function at 0x405840
Capabilities:
Get hostname
Resolve dns
Send data
Send data on socket
Set socket configuration

Disassembly:
sub esp, 0xa4
push ebx
push esi
push edi
mov esi, ecx
push str.About_to_open_a_UDP_socket_n
call fcn.00401430
add esp, 4
xor ebx, ebx
push ebx
push 2
push 2
call sub.WSOCK32.dll_socket
cmp eax, 0xffffffff
mov dword [esi + 4], eax
jne 0x40587a
pop edi
pop esi
xor al, al
pop ebx
add esp, 0xa4
ret 8
push eax
push str.Socket__d_opened_OK_n
call fcn.00401430
mov edi, dword [esp + 0xbc]
add esp, 8
mov word [esp + 0x18], 2
push edi
call sub.WSOCK32.dll_htons
push ebx
mov word [esp + 0x1e], ax
call sub.WSOCK32.dll_htonl
push edi
push str.About_to_bind_the_UDP_socket_to_port__d_n
mov dword [esp + 0x24], eax
call fcn.00401430
mov ecx, dword [esi + 4]
add esp, 8
lea eax, [esp + 0x18]
push 0x10
push eax
push ecx
call sub.WSOCK32.dll_bind
cmp eax, 0xffffffff
jne 0x405970
call sub.WSOCK32.dll_WSAGetLastError
push eax
push str.bind_failed_with_error_code__d_n
call fcn.00401430
mov edx, dword [esi + 8]
mov eax, dword [esi + 4]
push edx
push eax
push str.Closing_socket__d_bound_to_port__d_n
call fcn.00401430
mov eax, dword [esi + 0x20]
add esp, 0x14
cmp eax, ebx
je 0x405936
mov ecx, dword [esi + 0x14]
mov edx, dword [ecx]
push edx
call fcn.004067aa
mov eax, dword [esi + 0x20]
add esp, 4
cmp eax, ebx
jle 0x405931
lea ecx, [eax - 1]
xor eax, eax
cmp ecx, ebx
mov dword [esi + 0x20], ecx
jle 0x405931
mov ecx, dword [esi + 0x14]
inc eax
mov edx, dword [ecx + eax*4]
mov dword [ecx + eax*4 - 4], edx
mov ecx, dword [esi + 0x20]
cmp eax, ecx
jl 0x40591f
cmp dword [esi + 0x20], ebx
jne 0x4058fe
mov eax, dword [esi + 4]
cmp eax, 0xffffffff
je 0x405962
push eax
call sub.WSOCK32.dll_closesocket
test eax, eax
je 0x40595b
call sub.WSOCK32.dll_WSAGetLastError
push eax
push str.closesocket_failed_with_error_code__d_n
call fcn.00401430
add esp, 8
mov dword [esi + 4], 0xffffffff
pop edi
pop esi
xor al, al
pop ebx
add esp, 0xa4
ret 8
push str.Socket_bound_OK_n
call fcn.00401430
mov eax, dword [esp + 0xbc]
push str.About_to_query_the_host_name_n
mov dword [esi + 8], edi
mov dword [esi + 0xc], eax
call fcn.00401430
add esp, 8
lea ecx, [esp + 0x30]
push 0x80
push ecx
call sub.WSOCK32.dll_gethostname
test eax, eax
jne 0x4059b9
lea edx, [esp + 0x30]
push edx
push str.Host_name_is__s_n
call fcn.00401430
add esp, 8
push str.About_to_call_gethostbyname_n
call fcn.00401430
add esp, 4
lea eax, [esp + 0x30]
push eax
call sub.WSOCK32.dll_gethostbyname
mov edi, eax
cmp edi, ebx
jne 0x4059e9
call sub.WSOCK32.dll_WSAGetLastError
push eax
push str.gethostbyname_failed__Error_code__d_n
call fcn.00401430
add esp, 8
cmp dword [esi + 0x20], ebx
je 0x405a26
mov ecx, dword [esi + 0x14]
mov edx, dword [ecx]
push edx
call fcn.004067aa
mov eax, dword [esi + 0x20]
add esp, 4
cmp eax, ebx
jle 0x405a21
lea ecx, [eax - 1]
xor eax, eax
cmp ecx, ebx
mov dword [esi + 0x20], ecx
jle 0x405a21
mov ecx, dword [esi + 0x14]
inc eax
mov edx, dword [ecx + eax*4]
mov dword [ecx + eax*4 - 4], edx
mov ecx, dword [esi + 0x20]
cmp eax, ecx
jl 0x405a0f
cmp dword [esi + 0x20], ebx
jne 0x4059ee
mov edi, dword [edi + 0xc]
mov dword [esp + 0x10], edi
mov eax, dword [edi]
cmp eax, ebx
je 0x405ac9
push ebp
lea edi, [esi + 0x10]
mov ebx, dword [eax]
mov edx, dword [esp + 0x14]
mov eax, ebx
add edx, 4
shr eax, 0x18
mov dword [esp + 0x2c], ebx
mov dword [esp + 0x14], edx
xor ecx, ecx
push eax
mov cl, byte [esp + 0x32]
xor edx, edx
mov eax, ebx
mov dl, bh
push ecx
and eax, 0xff
push edx
push eax
push str.Found_local_address:__d._d._d._d_n
call fcn.00401430
push 4
call fcn.004067b5
mov ebp, eax
add esp, 0x18
mov dword [ebp], ebx
mov eax, dword [edi + 8]
cmp dword [edi + 0x10], eax
jl 0x405aa9
mov cl, byte [edi + 0xd]
test cl, cl
jne 0x405a92
test eax, eax
jne 0x405ab8
mov ecx, dword [edi + 0x14]
test ecx, ecx
jle 0x405ab8
mov edx, dword [edi]
add ecx, eax
push 0
push ecx
mov ecx, edi
call dword [edx + 8]
test al, al
je 0x405ab8
mov eax, dword [edi + 0x10]
mov edx, dword [edi + 4]
lea ecx, [eax + 1]
mov dword [edi + 0x10], ecx
mov dword [edx + eax*4], ebp
mov eax, dword [esp + 0x14]
mov eax, dword [eax]
test eax, eax
jne 0x405a3b
xor ebx, ebx
pop ebp
mov edx, dword [esi + 4]
lea ecx, [esp + 0x14]
push 4
push ecx
push 0x80
push 0xffff
push edx
mov word [esp + 0x28], bx
mov word [esp + 0x2a], bx
call sub.WSOCK32.dll_setsockopt
mov eax, dword [esi + 4]
push 4
push 0x40fe48
push 0x1002
push 0xffff
push eax
call sub.WSOCK32.dll_setsockopt
cmp eax, 0xffffffff
jne 0x405b21
call sub.WSOCK32.dll_WSAGetLastError
push eax
push str.Failed_to_set_socket_option_SO_RCVBUF___error_code__d._n
call fcn.00401430
add esp, 8
jmp 0x405b2e
push str.Socket_option_SO_RCVBUF_set_OK_n
call fcn.00401430
add esp, 4
mov ecx, dword [esi + 4]
push 4
push 0x40fe44
push 0x1001
push 0xffff
push ecx
call sub.WSOCK32.dll_setsockopt
cmp eax, 0xffffffff
jne 0x405b62
call sub.WSOCK32.dll_WSAGetLastError
push eax
push str.Failed_to_set_socket_option_SO_SNDBUF___error_code__d._n
call fcn.00401430
add esp, 8
jmp 0x405b6f
push str.Socket_option_SO_SNDBUF_set_OK_n
call fcn.00401430
add esp, 4
mov eax, dword [esi + 4]
lea edx, [esp + 0x2c]
push edx
push 0x8004667e
push eax
mov dword [esp + 0x38], 1
call sub.WSOCK32.dll_ioctlsocket
test eax, eax
je 0x405ba1
call sub.WSOCK32.dll_WSAGetLastError
push eax
push str.Failed_to_set_socket_to_non_blocking___error_code__d._n
call fcn.00401430
add esp, 8
push str.UDP_Socket_init_complete_n
call fcn.00401430
mov cx, word [esi + 0xc]
add esp, 4
mov dword [esp + 0xc], ebx
mov word [esp + 0x18], 2
push ecx
call sub.WSOCK32.dll_htons
mov edx, dword [0x411bd8]
mov word [esp + 0x1a], ax
lea eax, [esp + 0x18]
push 0x10
push eax
mov dword [esp + 0x24], edx
mov edx, dword [esi + 4]
push ebx
lea ecx, [esp + 0x18]
push 4
push ecx
push edx
call sub.WSOCK32.dll_sendto
mov edx, dword [esi + 4]
lea eax, [esp + 0x18]
push 0x10
push eax
push ebx
lea ecx, [esp + 0x18]
push 4
push ecx
push edx
call sub.WSOCK32.dll_sendto
mov ax, word [esi + 8]
push eax
call sub.WSOCK32.dll_htons
lea ecx, [esp + 0x18]
push 0x10
push ecx
mov word [esp + 0x22], ax
mov eax, dword [esi + 4]
push ebx
lea edx, [esp + 0x18]
push 4
push edx
push eax
call sub.WSOCK32.dll_sendto
mov eax, dword [esi + 4]
lea ecx, [esp + 0x18]
push 0x10
push ecx
push ebx
lea edx, [esp + 0x18]
push 4
push edx
push eax
call sub.WSOCK32.dll_sendto
pop edi
pop esi
mov al, 1
pop ebx
add esp, 0xa4
ret 8