Function at 0x404390
Capabilities:
Download and write a file
Get socket status
Receive and write data from server to client
Receive data
Receive data on socket
Send data
Send data on socket
Write file on windows

Disassembly:
sub esp, 0x310
push ebx
push ebp
push esi
mov esi, dword [esp + 0x320]
push edi
xor edi, edi
mov eax, dword [esi + 0x10]
push 4
mov dword [esp + 0x14], eax
mov dword [esi + 0x38], edi
mov dword [esi + 0x34], edi
lea ebp, [esi + 0x4054]
call sub.WSOCK32.dll_htons
mov word [ebp], ax
mov cx, word [esi + 0x24]
push ecx
call sub.WSOCK32.dll_htons
mov word [ebp + 2], ax
mov edx, dword [esi + 0x18]
push edi
push 4
push ebp
push edx
call sub.WSOCK32.dll_send
cmp eax, 4
jne 0x404509
mov eax, dword [esi + 0x18]
mov dword [esp + 0x21c], 1
mov dword [esp + 0x220], eax
mov eax, dword [esi + 0x34]
sub eax, edi
mov dword [esp + 0x18], edi
je 0x40441d
dec eax
je 0x404411
mov ecx, dword [esi + 0x40]
mov dword [esp + 0x14], ecx
jmp 0x40442a
mov edx, dword [esi + 0x40]
inc edx
shr edx, 1
mov dword [esp + 0x14], edx
jmp 0x40442a
mov eax, dword [esi + 0x40]
add eax, 3
shr eax, 2
mov dword [esp + 0x14], eax
lea ecx, [esp + 0x14]
lea edx, [esp + 0x21c]
push ecx
push edi
push edi
push edx
push 1
call sub.WSOCK32.dll_select
cmp eax, 0xffffffff
jne 0x404558
call fcn.00402c20
push eax
push str.select
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea eax, [esp + 0x28]
push str.error__d_in_system_call__s__s
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
mov edx, dword [esi + 0x446c]
mov eax, dword [esi + 0x10]
lea ecx, [esp + 0x30]
push ecx
push edx
push eax
push edi
call fcn.004053b0
push edi
push esi
call fcn.00405310
add esp, 0x2c
mov eax, dword [esi + 0x24]
mov ecx, dword [esi + 0x446c]
mov edx, dword [esp + 0x10]
inc eax
push eax
push str.timeout_while_waiting_for_data_blk__d
push ecx
push edx
push 9
call fcn.004053b0
mov eax, dword [esi + 0x34]
add esp, 0x14
inc eax
mov dword [esi + 0x34], eax
mov eax, dword [esi + 0x30]
mov ecx, dword [esi + 0x3c]
cmp eax, ecx
mov eax, dword [0x412620]
jne 0x40476a
cmp dword [esi + 0x38], 0x32
jae 0x404770
cmp dword [esi + 0x34], eax
jae 0x40476a
push 4
call sub.WSOCK32.dll_htons
mov word [ebp], ax
mov cx, word [esi + 0x24]
push ecx
call sub.WSOCK32.dll_htons
xor edi, edi
mov word [ebp + 2], ax
mov edx, dword [esi + 0x18]
push edi
push 4
push ebp
push edx
call sub.WSOCK32.dll_send
cmp eax, 4
je 0x4043e5
call fcn.00402c20
push eax
push str.send
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea eax, [esp + 0x28]
push str.error__d_in_system_call__s__s
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
mov edx, dword [esi + 0x446c]
mov eax, dword [esi + 0x10]
lea ecx, [esp + 0x30]
push ecx
push edx
push eax
push edi
call fcn.004053b0
push edi
push esi
call fcn.00405310
add esp, 0x2c
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x310
ret
cmp eax, edi
je 0x40448b
mov ecx, dword [esi + 0x18]
lea ebx, [esi + 0x50]
push edi
push 0x4004
push ebx
push ecx
call sub.WSOCK32.dll_recv
mov edi, eax
test edi, edi
jle 0x404659
cmp edi, 4
jb 0x4046aa
mov dx, word [ebx]
push edx
call sub.WSOCK32.dll_ntohs
cmp ax, 3
jne 0x4046da
mov ax, word [ebx + 2]
push eax
call sub.WSOCK32.dll_ntohs
test ax, ax
jne 0x4045e1
mov ecx, dword [esi + 0x24]
inc ecx
cmp ecx, 1
jne 0x4045e1
mov eax, dword [esi + 0x4470]
test eax, eax
jne 0x4045e1
cmp dword [esi + 0x38], ecx
jne 0x4045e1
mov edx, dword [esi + 0x446c]
mov eax, dword [esp + 0x10]
push str.WARNING:_First_block_sent_by_client_is_0__should_be_1__fixed_by_Tftpd32
push edx
push eax
push ecx
call fcn.004053b0
mov eax, dword [esi + 0x24]
add esp, 0x10
dec eax
mov dword [esi + 0x24], eax
mov cx, word [ebx + 2]
push ecx
call sub.WSOCK32.dll_ntohs
mov dx, word [esi + 0x24]
inc dx
cmp ax, dx
jne 0x4044b2
mov eax, dword [esi + 0x34]
mov ecx, dword [esi + 0x4474]
mov edx, dword [esi + 0x24]
add ecx, eax
mov dword [esi + 0x4474], ecx
xor ecx, ecx
lea eax, [edi - 4]
lea edi, [esi + 0x30]
push ecx
mov dword [esi + 0x34], ecx
mov dword [esi + 0x38], ecx
mov ecx, dword [esi + 0x1c]
push edi
add ebx, 4
push eax
inc edx
push ebx
push ecx
mov dword [esi + 0x24], edx
mov dword [edi], eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x404719
mov edx, dword [edi]
mov edi, dword [esi + 0x4470]
add edi, edx
push esi
mov dword [esi + 0x4470], edi
call fcn.00404160
add esp, 4
jmp 0x4044b2
call fcn.00402c20
push eax
push str.recv
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esp + 0x28]
push str.error__d_in_system_call__s__s
push ecx
call dword [sym.imp.USER32.dll_wsprintfA]
mov eax, dword [esi + 0x446c]
mov ecx, dword [esi + 0x10]
lea edx, [esp + 0x30]
push edx
push eax
push ecx
push 0
call fcn.004053b0
push 0
push esi
call fcn.00405310
add esp, 0x2c
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x310
ret
mov edx, dword [esi + 0x446c]
mov eax, dword [esp + 0x10]
push str.rcvd_packet_too_short
push edx
push eax
push 1
call fcn.004053b0
push 4
push esi
call fcn.00405310
add esp, 0x18
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x310
ret
mov cx, word [ebx]
push ecx
call sub.WSOCK32.dll_ntohs
mov edx, dword [esi + 0x446c]
and eax, 0xffff
push eax
mov eax, dword [esp + 0x14]
push str.Peer_sent_unexpected_message__d
push edx
push eax
push 1
call fcn.004053b0
push 4
push esi
call fcn.00405310
add esp, 0x1c
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x310
ret
call fcn.00402c20
push eax
push str.write
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esp + 0x28]
push str.error__d_in_system_call__s__s
push ecx
call dword [sym.imp.USER32.dll_wsprintfA]
mov eax, dword [esi + 0x446c]
mov ecx, dword [esi + 0x10]
lea edx, [esp + 0x30]
push edx
push eax
push ecx
push 0
call fcn.004053b0
push 3
push esi
call fcn.00405310
add esp, 0x2c
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x310
ret
cmp dword [esi + 0x38], 0x32
jb 0x4047b3
mov ax, word [esi + 0x24]
mov ecx, dword [esi + 0x446c]
inc ax
lea edx, [esi + 0x426a]
and eax, 0xffff
push edx
mov edx, dword [esp + 0x14]
push eax
push str.MAX_RETRIES_while_waiting_for_Data_block__d._file___s_
push ecx
push edx
push 0
call fcn.004053b0
push 0
push esi
call fcn.00405310
add esp, 0x20
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x310
ret
cmp dword [esi + 0x34], eax
jb 0x4047fc
mov cx, word [esi + 0x24]
mov edx, dword [esi + 0x446c]
inc cx
lea eax, [esi + 0x426a]
and ecx, 0xffff
push eax
mov eax, dword [esp + 0x14]
push ecx
push str.TIMEOUT_while_waiting_for_Data_block__d__file___s_
push edx
push eax
push 0
call fcn.004053b0
push 0
push esi
call fcn.00405310
add esp, 0x20
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x310
ret
push 4
call sub.WSOCK32.dll_htons
mov word [ebp], ax
mov cx, word [esi + 0x24]
push ecx
call sub.WSOCK32.dll_htons
mov word [ebp + 2], ax
mov edx, dword [esi + 0x18]
push 0
push 4
push ebp
push edx
call sub.WSOCK32.dll_send
mov cx, word [esi + 0x4268]
mov eax, dword [esi + 0x10]
push ecx
mov dword [esp + 0x18], eax
call sub.WSOCK32.dll_ntohs
mov ebp, dword [esi + 0x24]
cmp ax, 1
jne 0x404841
dec ebp
mov eax, dword [esi + 0x4474]
mov ebx, 0x4144a4
cmp eax, 1
mov dword [esp + 0x10], 0x411b44
ja 0x40485d
mov dword [esp + 0x10], ebx
cmp ebp, 1
jle 0x404867
mov ebx, 0x411b44
mov dx, word [esi + 0x4268]
push edx
call sub.WSOCK32.dll_ntohs
cmp ax, 1
mov edi, str.sent
je 0x404884
mov edi, str.rcvd
mov eax, dword [esp + 0x10]
mov ecx, dword [esi + 0x4474]
push eax
push ecx
push 0
call fcn.004096e6
mov ecx, dword [esi + 0x447c]
mov edx, dword [esi + 0x4470]
add esp, 4
sub eax, ecx
mov ecx, dword [esi + 0x446c]
push eax
push edx
mov edx, dword [esp + 0x24]
push ebx
push ebp
lea eax, [esi + 0x426a]
push edi
push eax
push str.__s_:__s__d_blk_s___d_bytes_in__d_s.__d_blk_s_resent
push ecx
push edx
push 2
call fcn.004053b0
mov eax, dword [0x412644]
add esp, 0x30
test eax, eax
je 0x4048f7
push 0
call fcn.004096e6
mov edx, dword [esi + 0x447c]
add esp, 4
sub eax, edx
cmp eax, 0xa
jle 0x4048f7
push 0x40
call dword [sym.imp.USER32.dll_MessageBeep]
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x310
ret