Function at 0x404990
Capabilities:
Get socket status
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:
sub esp, 0x510
push ebx
push ebp
push esi
mov esi, dword [esp + 0x520]
xor ebx, ebx
push edi
mov ebp, dword [esi + 0x10]
mov dword [esi + 0x2c], 1
mov dword [esi + 0x38], ebx
mov dword [esi + 0x34], ebx
cmp dword [esi + 0x34], ebx
jbe 0x4049be
mov eax, dword [esi + 0x24]
mov dword [esi + 0x2c], eax
cmp dword [esi + 0x24], ebx
jbe 0x404a78
mov ecx, dword [esi + 0x48]
mov edx, dword [esi + 0x24]
lea eax, [ecx + edx]
mov ecx, dword [esi + 0x28]
cmp eax, ecx
jae 0x4049d9
mov ecx, eax
mov eax, dword [esi + 0x2c]
cmp eax, ecx
ja 0x404a76
dec eax
push 0
imul eax, dword [esi + 0x3c]
push 0
push eax
mov eax, dword [esi + 0x1c]
lea edi, [esi + 0x50]
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
je 0x404cca
mov ecx, dword [esi + 0x3c]
mov eax, dword [esi + 0x1c]
lea ebx, [esi + 0x30]
push 0
push ebx
lea edx, [edi + 4]
push ecx
push edx
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x404cca
push 3
call sub.WSOCK32.dll_htons
mov word [edi], ax
mov cx, word [esi + 0x2c]
push ecx
call sub.WSOCK32.dll_htons
mov word [edi + 2], ax
mov edx, dword [ebx]
mov eax, dword [esi + 0x18]
add edx, 4
push 0
push edx
push edi
push eax
call sub.WSOCK32.dll_send
test eax, eax
jl 0x404d28
mov ecx, dword [ebx]
add ecx, 4
cmp eax, ecx
jne 0x404d28
mov ecx, dword [esi + 0x38]
mov eax, dword [esi + 0x2c]
inc ecx
inc eax
mov dword [esi + 0x38], ecx
mov dword [esi + 0x2c], eax
jmp 0x4049c7
xor ebx, ebx
mov eax, dword [esi + 0x34]
mov edx, dword [esi + 0x18]
sub eax, ebx
mov dword [esp + 0x20], edx
mov dword [esp + 0x1c], 1
mov dword [esp + 0x14], ebx
je 0x404aaa
dec eax
je 0x404a9e
mov eax, dword [esi + 0x40]
mov dword [esp + 0x10], eax
jmp 0x404ab7
mov ecx, dword [esi + 0x40]
inc ecx
shr ecx, 1
mov dword [esp + 0x10], ecx
jmp 0x404ab7
mov edx, dword [esi + 0x40]
add edx, 3
shr edx, 2
mov dword [esp + 0x10], edx
lea eax, [esp + 0x10]
lea ecx, [esp + 0x1c]
push eax
push ebx
push ebx
push ecx
push 1
call sub.WSOCK32.dll_select
cmp eax, 0xffffffff
jne 0x404b71
call fcn.00403340
push eax
push str.select
call dword [sym.imp.KERNEL32.dll_GetLastError]
lea edx, [esi + 0x426a]
push eax
push edx
lea eax, [esp + 0x130]
push str.File___s__:_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 + 0x138]
push ecx
push edx
push eax
push ebx
call fcn.00408200
push ebx
push esi
call fcn.004061d0
add esp, 0x30
mov eax, dword [esi + 0x24]
mov ecx, dword [esi + 0x446c]
push eax
push str.timeout_while_waiting_for_ack_blk__d
push ecx
push ebp
push 9
call fcn.00408200
mov eax, dword [esi + 0x34]
add esp, 0x14
inc eax
mov dword [esi + 0x34], eax
mov edx, dword [esi + 0x2c]
mov eax, dword [esi + 0x28]
cmp edx, eax
mov eax, dword [0x416b20]
ja 0x404e0a
cmp dword [esi + 0x38], 0x32
jae 0x404e10
cmp dword [esi + 0x34], eax
jae 0x404e0a
xor ebx, ebx
jmp 0x4049b3
cmp eax, ebx
je 0x404b22
mov ecx, dword [esi + 0x18]
lea edi, [esi + 0x4054]
push ebx
push 0x204
push edi
push ecx
call sub.WSOCK32.dll_recv
cmp eax, ebx
jle 0x404d86
cmp eax, 4
jae 0x404bb1
mov edx, dword [esi + 0x446c]
push str.rcvd_packet_too_short
push edx
push ebp
push 1
call fcn.00408200
add esp, 0x10
jmp 0x404b44
mov ax, word [edi]
push eax
call sub.WSOCK32.dll_ntohs
cmp ax, 5
je 0x404de2
mov cx, word [edi]
push ecx
call sub.WSOCK32.dll_ntohs
cmp ax, 4
jne 0x404c9f
mov dx, word [edi + 2]
push edx
call sub.WSOCK32.dll_ntohs
cmp ax, word [esi + 0x24]
jne 0x404c28
mov eax, dword [esi + 0x34]
mov edx, dword [esi + 0x4474]
add edx, eax
mov eax, dword [esi + 0x24]
cmp eax, ebx
mov dword [esi + 0x4474], edx
mov dword [esi + 0x34], ebx
mov dword [esi + 0x38], ebx
je 0x404c16
mov ecx, dword [esi + 0x30]
mov edx, dword [esi + 0x4470]
add edx, ecx
mov dword [esi + 0x4470], edx
inc eax
push esi
mov dword [esi + 0x24], eax
call fcn.00404f90
add esp, 4
jmp 0x404b44
cmp dword [esi + 0x38], 3
jae 0x404c58
cmp dword [esi + 0x24], 1
je 0x404c58
mov dx, word [edi + 2]
push edx
call sub.WSOCK32.dll_ntohs
mov cx, word [esi + 0x24]
dec cx
cmp ax, cx
jne 0x404c58
xor edx, edx
push ebx
mov dx, word [esi + 0x24]
push edx
push str.Ack_block__d_ignored__received_twice_
jmp 0x404c88
mov cx, word [edi + 2]
mov ebx, dword [esi + 0x24]
push ecx
call sub.WSOCK32.dll_ntohs
and eax, 0xffff
cmp eax, ebx
jbe 0x404b44
mov dx, word [edi + 2]
push ebx
push edx
call sub.WSOCK32.dll_ntohs
and eax, 0xffff
push eax
push str.Ack_of_block__d_received__last_block_sent__d___
mov eax, dword [esi + 0x446c]
push eax
push ebp
push 1
call fcn.00408200
add esp, 0x18
jmp 0x404b44
mov cx, word [edi]
push ecx
call sub.WSOCK32.dll_ntohs
mov edx, dword [esi + 0x446c]
and eax, 0xffff
push eax
push str.ignore_unknown_opcode__d_received
push edx
push ebp
push 2
call fcn.00408200
add esp, 0x14
jmp 0x404b44
call fcn.00403340
push eax
push str.ReadFile
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea eax, [esi + 0x426a]
push eax
lea ecx, [esp + 0x130]
push str.File___s__:_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 + 0x138]
push edx
push eax
push ecx
push 0
call fcn.00408200
push 0
push esi
call fcn.004061d0
add esp, 0x30
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x510
ret
call fcn.00403340
push eax
push str.send
call dword [sym.imp.KERNEL32.dll_GetLastError]
lea edx, [esi + 0x426a]
push eax
push edx
lea eax, [esp + 0x130]
push str.File___s__:_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 + 0x138]
push ecx
push edx
push eax
push 0
call fcn.00408200
push 0
push esi
call fcn.004061d0
add esp, 0x30
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x510
ret
call fcn.00403340
push eax
push str.recv
call dword [sym.imp.KERNEL32.dll_GetLastError]
lea ecx, [esi + 0x426a]
push eax
push ecx
lea edx, [esp + 0x130]
push str.File___s__:_error__d_in_system_call__s__s
push edx
call dword [sym.imp.USER32.dll_wsprintfA]
mov ecx, dword [esi + 0x446c]
mov edx, dword [esi + 0x10]
lea eax, [esp + 0x138]
push eax
push ecx
push edx
push ebx
call fcn.00408200
push ebx
push esi
call fcn.004061d0
add esp, 0x30
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x510
ret
mov eax, dword [esi + 0x446c]
add edi, 4
push edi
push str.Peer_returns_ERROR___s_____aborting_transfer
push eax
push ebp
push 1
call fcn.00408200
add esp, 0x14
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x510
ret
cmp dword [esi + 0x38], 0x32
jb 0x404e4a
mov eax, dword [esi + 0x446c]
xor edx, edx
mov dx, word [esi + 0x24]
lea ecx, [esi + 0x426a]
push ecx
push edx
push str.MAX_RETRIES_while_waiting_for_Ack_block__d._file___s_
push eax
push ebp
push 0
call fcn.00408200
push 0
push esi
call fcn.004061d0
add esp, 0x20
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x510
ret
cmp dword [esi + 0x34], eax
jb 0x404e7f
mov ecx, dword [esi + 0x24]
mov edx, dword [esi + 0x446c]
push ecx
push str.TIMEOUT_waiting_for_Ack_block__d
push edx
push ebp
push 1
call fcn.00408200
push 0
push esi
call fcn.004061d0
add esp, 0x1c
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x510
ret
mov eax, dword [esi + 0x2c]
mov ecx, dword [esi + 0x24]
mov edx, dword [esi + 0x446c]
push eax
push ecx
push str.Count__d__Last_pkt__d
push edx
push ebp
push 0xa
call fcn.00408200
mov cx, word [esi + 0x4268]
mov eax, dword [esi + 0x10]
add esp, 0x18
mov dword [esp + 0x10], eax
push ecx
call sub.WSOCK32.dll_ntohs
mov ebp, dword [esi + 0x24]
cmp ax, 1
jne 0x404ebc
dec ebp
mov eax, dword [esi + 0x4474]
mov ebx, 0x41b998
cmp eax, 1
mov dword [esp + 0x18], 0x415dd0
ja 0x404ed8
mov dword [esp + 0x18], ebx
cmp ebp, 1
jle 0x404ee2
mov ebx, 0x415dd0
mov dx, word [esi + 0x4268]
push edx
call sub.WSOCK32.dll_ntohs
cmp ax, 1
mov edi, str.sent
je 0x404eff
mov edi, str.rcvd
mov eax, dword [esp + 0x18]
mov ecx, dword [esi + 0x4474]
push eax
push ecx
push 0
call fcn.0040b12b
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 + 0x20]
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.00408200
mov eax, dword [0x416b4c]
add esp, 0x30
test eax, eax
je 0x404f72
push 0
call fcn.0040b12b
mov edx, dword [esi + 0x447c]
add esp, 4
sub eax, edx
cmp eax, 0xa
jle 0x404f72
push 0x40
call dword [sym.imp.USER32.dll_MessageBeep]
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x510
ret