Function at 0x406720
Capabilities:
Read and send data from client to server
Read file on windows
Receive data
Receive data on socket
Send data
Send data on socket

Disassembly:
push ebx
mov ebx, dword [esp + 8]
push ebp
mov ebp, dword [ebx + 0x10]
push esi
xor esi, esi
cmp dword [ebx + 0x4494], esi
push edi
mov dword [esp + 0x14], ebp
mov dword [ebx + 0x30], 1
je 0x40674f
lea eax, [ebx + 0x4498]
push eax
call fcn.00403860
add esp, 4
mov dword [ebx + 0x3c], esi
mov dword [ebx + 0x38], esi
cmp dword [ebx + 0x38], 0
jbe 0x406761
mov ecx, dword [ebx + 0x28]
mov dword [ebx + 0x30], ecx
cmp dword [ebx + 0x28], 0
jbe 0x406857
jmp 0x406770
mov edx, dword [ebx + 0x4c]
mov eax, dword [ebx + 0x28]
mov ecx, dword [ebx + 0x2c]
add eax, edx
cmp eax, ecx
jae 0x406781
mov ecx, eax
mov eax, dword [ebx + 0x30]
cmp eax, ecx
ja 0x406857
mov ecx, dword [ebx + 0x1c]
add eax, 0xffffffff
imul eax, dword [ebx + 0x40]
push 0
push 0
push eax
push ecx
lea esi, [ebx + 0x58]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
je 0x406a3d
mov edx, dword [ebx + 0x40]
mov eax, dword [ebx + 0x1c]
push 0
lea edi, [ebx + 0x34]
push edi
push edx
lea ebp, [esi + 4]
push ebp
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x406a3d
cmp dword [ebx + 0x4494], 0
je 0x4067ea
mov ecx, dword [edi]
push ecx
lea edx, [ebx + 0x4498]
push ebp
push edx
call fcn.00403f60
add esp, 0xc
push 3
call sub.WSOCK32.dll_htons
mov word [esi], ax
movzx eax, word [ebx + 0x30]
push eax
call sub.WSOCK32.dll_htons
push ebx
mov word [esi + 2], ax
call fcn.00408fc0
add esp, 4
cmp dword [ebx + 0x24], 0
je 0x40681c
push ebx
call fcn.00405370
add esp, 4
jmp 0x40682e
mov ecx, dword [edi]
mov edx, dword [ebx + 0x18]
push 0
add ecx, 4
push ecx
push esi
push edx
call sub.WSOCK32.dll_send
test eax, eax
jl 0x406a53
mov ecx, dword [edi]
add ecx, 4
cmp eax, ecx
jne 0x406a53
mov ebp, dword [esp + 0x14]
mov eax, 1
add dword [ebx + 0x3c], eax
add dword [ebx + 0x30], eax
jmp 0x406770
mov edi, ebx
call fcn.00405e60
test eax, eax
je 0x4069c7
mov edx, dword [ebx + 0x18]
xor edi, edi
push edi
push 0x204
lea esi, [ebx + 0x405c]
push esi
push edx
call sub.WSOCK32.dll_recv
cmp eax, edi
jle 0x406a69
cmp eax, 4
jae 0x4068a7
mov eax, dword [ebx + 0x4474]
push str.rcvd_packet_too_short
push eax
push ebp
push 1
call fcn.00409890
add esp, 0x10
jmp 0x4069e6
movzx ecx, word [esi]
push ecx
call sub.WSOCK32.dll_ntohs
cmp ax, 5
je 0x406a7e
movzx edx, word [esi]
push edx
call sub.WSOCK32.dll_ntohs
cmp ax, 4
jne 0x4069a1
push ebx
call fcn.00408fc0
movzx eax, word [esi + 2]
add esp, 4
push eax
call sub.WSOCK32.dll_ntohs
cmp ax, word [ebx + 0x28]
jne 0x406917
mov ecx, dword [ebx + 0x38]
mov eax, dword [ebx + 0x28]
add dword [ebx + 0x447c], ecx
cmp eax, edi
mov dword [ebx + 0x38], edi
mov dword [ebx + 0x3c], edi
je 0x406905
mov edx, dword [ebx + 0x34]
add dword [ebx + 0x4478], edx
add eax, 1
mov esi, ebx
mov dword [ebx + 0x28], eax
call fcn.00405400
jmp 0x4069e6
cmp dword [ebx + 0x3c], 3
jae 0x40695c
cmp dword [ebx + 0x28], 1
je 0x40695c
movzx eax, word [esi + 2]
push eax
call sub.WSOCK32.dll_ntohs
mov cx, word [ebx + 0x28]
sub cx, 1
cmp ax, cx
jne 0x40695c
movzx edx, word [ebx + 0x28]
mov eax, dword [ebx + 0x4474]
push edi
push edx
push str.Ack_block__d_ignored__received_twice_
push eax
push ebp
push 1
call fcn.00409890
add esp, 0x18
jmp 0x4069e6
cmp dword [ebx + 0x24], edi
jne 0x4069e6
movzx ecx, word [esi + 2]
mov edi, dword [ebx + 0x28]
push ecx
call sub.WSOCK32.dll_ntohs
movzx edx, ax
cmp edx, edi
jbe 0x4069e6
movzx eax, word [esi + 2]
push edi
push eax
call sub.WSOCK32.dll_ntohs
mov edx, dword [ebx + 0x4474]
movzx ecx, ax
push ecx
push str.Ack_of_block__d_received__last_block_sent__d___
push edx
push ebp
push 1
call fcn.00409890
add esp, 0x18
jmp 0x4069e6
movzx eax, word [esi]
push eax
call sub.WSOCK32.dll_ntohs
mov edx, dword [ebx + 0x4474]
movzx ecx, ax
push ecx
push str.ignore_unknown_opcode__d_received
push edx
push ebp
push 2
call fcn.00409890
add esp, 0x14
jmp 0x4069e6
mov eax, dword [ebx + 0x28]
mov ecx, dword [ebx + 0x4474]
push eax
push str.timeout_while_waiting_for_ack_blk__d
push ecx
push ebp
push 9
call fcn.00409890
add esp, 0x14
add dword [ebx + 0x38], 1
mov edx, dword [ebx + 0x30]
cmp edx, dword [ebx + 0x2c]
mov eax, dword [0x41e388]
ja 0x406a02
cmp dword [ebx + 0x3c], 0x32
jae 0x406a0c
cmp dword [ebx + 0x38], eax
jb 0x406755
cmp dword [ebx + 0x3c], 0x32
jb 0x406aa0
movzx edx, word [ebx + 0x28]
mov eax, dword [ebx + 0x4474]
lea ecx, [ebx + 0x4272]
push ecx
push edx
push str.MAX_RETRIES_while_waiting_for_Ack_block__d._file___s_
push eax
push ebp
push 0
call fcn.00409890
push 0
call fcn.004057e0
add esp, 0x1c
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
ret
push 0
mov esi, 0x41a33c
mov ecx, ebx
call fcn.00405de0
add esp, 4
pop edi
pop esi
pop ebp
pop ebx
ret
push 0
mov esi, str.send
mov ecx, ebx
call fcn.00405de0
add esp, 4
pop edi
pop esi
pop ebp
pop ebx
ret
push edi
mov esi, str.recv
mov ecx, ebx
call fcn.00405de0
add esp, 4
pop edi
pop esi
pop ebp
pop ebx
ret
mov eax, dword [ebx + 0x4474]
add esi, 4
push esi
push str.Peer_returns_ERROR___s_____aborting_transfer
push eax
push ebp
push 1
call fcn.00409890
add esp, 0x14
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
ret
cmp dword [ebx + 0x38], eax
mov ecx, dword [ebx + 0x28]
mov edx, dword [ebx + 0x4474]
jb 0x406ace
push ecx
push str.TIMEOUT_waiting_for_Ack_block__d
push edx
push ebp
push 1
call fcn.00409890
push 0
call fcn.004057e0
add esp, 0x18
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
ret
mov eax, dword [ebx + 0x30]
push eax
push ecx
push str.Count__d__Last_pkt__d
push edx
push ebp
push 0xa
call fcn.00409890
add esp, 0x18
cmp dword [ebx + 0x4494], 0
je 0x406afa
cmp dword [ebx + 0x24], 0
jne 0x406afa
mov esi, ebx
call fcn.004051d0
push ebx
call fcn.004056d0
add esp, 4
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
ret