Function at 0x402000
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, 0x34
push ebx
push ebp
push esi
mov esi, dword [0x414004]
push edi
lea eax, [esp + 0x28]
xor edi, edi
push eax
mov dword [esp + 0x14], esi
mov dword [esp + 0x34], edi
mov dword [esp + 0x38], 0x3e8
call fcn.00404311
push 1
call fcn.00403635
add esp, 8
test eax, eax
jne 0x402046
push 0x8000
push 1
call fcn.00404169
add esp, 8
push edi
call fcn.00403635
add esp, 4
mov dword [esp + 0x24], eax
cmp eax, edi
jne 0x402065
push 0x8000
push edi
call fcn.00404169
add esp, 8
mov ecx, dword [0x415ce4]
mov eax, dword [ecx]
cmp eax, 0x40
jae 0x402078
mov dword [ecx + eax*4 + 4], esi
inc dword [ecx]
mov eax, dword [0x414adc]
xor ebp, ebp
mov dword [esp + 0x1c], edi
mov dword [esp + 0x18], edi
cmp eax, edi
je 0x402101
mov ebx, dword [0x415c88]
mov ebp, eax
mov dword [esp + 0x1c], 1
cmp word [0x414020], di
je 0x4020ac
mov dword [0x414adc], edi
jmp 0x402105
mov esi, dword [ecx]
xor eax, eax
cmp esi, edi
jbe 0x4020f2
lea edx, [ecx + 4]
cmp dword [edx], edi
je 0x4020d2
inc eax
add edx, 4
cmp eax, esi
jb 0x4020b7
push edi
call fcn.0040d70b
mov esi, dword [esp + 0x14]
add esp, 4
jmp 0x402105
dec esi
cmp eax, esi
jae 0x4020f0
lea edx, [ecx + eax*4 + 4]
jmp 0x4020e0
mov esi, dword [edx + 4]
mov dword [edx], esi
mov esi, dword [ecx]
inc eax
dec esi
add edx, 4
cmp eax, esi
jb 0x4020e0
dec dword [ecx]
push edi
call fcn.0040d70b
mov esi, dword [esp + 0x14]
add esp, 4
jmp 0x402105
mov ebx, dword [esp + 0x24]
mov eax, dword [0x414b08]
cmp eax, edi
je 0x402117
push eax
call fcn.00403a7a
add esp, 4
call fcn.00403db7
push edi
mov dword [eax], edi
call sub.WS2_32.dll_WSASetLastError
mov ecx, dword [0x415ce4]
push ecx
push esi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x40245d
lea esp, [esp]
cmp word [esp + 0x1c], 0
mov dword [esp + 0x20], 0x2008
je 0x40215d
mov dword [esp + 0x1c], 0
jmp 0x40232a
mov edx, dword [0x415c84]
mov eax, dword [0x414ae8]
mov esi, dword [0x415ce4]
mov ecx, 0x41
mov edi, edx
rep movsd dword es:[edi], dword [esi]
test eax, eax
je 0x40218b
mov esi, dword [eax]
mov ecx, dword [0x414aec]
mov eax, dword [eax + 4]
mov dword [ecx], esi
mov dword [ecx + 4], eax
lea ecx, [esp + 0x30]
push ecx
push 0
push 0
push edx
push 0x10
call sub.WS2_32.dll_select
mov esi, eax
test esi, esi
jge 0x4021b4
call sub.WS2_32.dll_WSAGetLastError
cmp eax, 0x2714
jne 0x402475
test esi, esi
jne 0x4021f6
lea edx, [esp + 0x38]
push edx
call fcn.00404311
add esp, 4
cmp dword [0x414b24], 0
jbe 0x4021f6
mov esi, dword [esp + 0x38]
sub esi, dword [esp + 0x28]
mov eax, dword [0x414ae8]
mov ecx, dword [esp + 0x3c]
mov eax, dword [eax]
sbb ecx, dword [esp + 0x2c]
cdq
cmp ecx, edx
jg 0x4024a6
jl 0x4021f6
cmp esi, eax
ja 0x4024a6
mov ecx, dword [0x415c84]
mov edi, dword [esp + 0x10]
push ecx
push edi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x402284
lea edx, [esp + 0x28]
push edx
call fcn.00404311
mov eax, dword [0x415ce0]
add esp, 4
push 0
push 0x2000
push eax
push edi
call sub.WS2_32.dll_recv
test eax, eax
jg 0x402276
mov edx, dword [0x415ce4]
mov esi, dword [edx]
xor eax, eax
test esi, esi
jbe 0x402272
lea ecx, [edx + 4]
cmp dword [ecx], edi
je 0x402250
inc eax
add ecx, 4
cmp eax, esi
jb 0x402240
xor ebp, ebp
jmp 0x40228c
dec esi
cmp eax, esi
jae 0x402270
lea ecx, [edx + eax*4 + 4]
lea esp, [esp]
mov esi, dword [ecx + 4]
mov dword [ecx], esi
mov esi, dword [edx]
inc eax
dec esi
add ecx, 4
cmp eax, esi
jb 0x402260
dec dword [edx]
xor ebp, ebp
jmp 0x40228c
mov ecx, dword [0x415ce0]
mov dword [esp + 0x18], eax
mov dword [esp + 0x14], ecx
test ebp, ebp
jne 0x40232a
cmp dword [esp + 0x24], 0
je 0x4022ef
call fcn.0040e186
test eax, eax
je 0x40232a
mov edx, dword [0x415c88]
push edx
call fcn.004038af
mov esi, dword [0x415c88]
mov edi, esi
add esp, 4
dec edi
mov al, byte [edi + 1]
inc edi
test al, al
jne 0x4022b8
mov ax, word [0x410a94]
mov word [edi], ax
mov eax, esi
lea edx, [eax + 1]
mov edi, edi
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x4022d0
sub eax, edx
cmp word [0x414020], 0
mov ebp, eax
mov ebx, esi
jne 0x40232a
mov dword [0x414adc], ebp
jmp 0x402320
mov ecx, dword [0x415c88]
push 0x2000
push ecx
push 0
call fcn.0040b3b4
add esp, 0xc
test eax, eax
jle 0x402320
cmp word [0x414020], 0
mov ebx, dword [0x415c88]
mov ebp, eax
jne 0x40232a
mov dword [0x414adc], eax
push 0
call fcn.0040d70b
add esp, 4
mov edi, dword [esp + 0x18]
mov edi, edi
cmp ebp, 0x2008
ja 0x402340
cmp edi, 0x2008
jbe 0x402357
push edi
push ebp
push str.Preposterous_Pointers:__d___d
call fcn.004012a0
xor edi, edi
add esp, 0xc
mov dword [esp + 0x18], edi
xor ebp, ebp
cmp word [esp + 0x20], 0
je 0x4024ec
test edi, edi
je 0x4023b0
mov edx, dword [esp + 0x14]
push edi
push edx
push 1
call fcn.004078fc
mov esi, eax
call fcn.004038c5
push eax
call fcn.00403cf8
add esp, 0x10
test esi, esi
jle 0x4023b0
cmp word [0x414b14], 0
je 0x4023a0
mov eax, dword [esp + 0x14]
push esi
push eax
call fcn.00401ec0
add esp, 8
add dword [esp + 0x14], esi
sub edi, esi
add dword [0x414ae0], esi
mov dword [esp + 0x18], edi
test ebp, ebp
je 0x402409
cmp dword [0x414b08], 0
je 0x4023eb
test ebx, ebx
jne 0x4023c5
xor eax, eax
jmp 0x4023ed
cmp ebp, 0x2000
jbe 0x4023d1
xor eax, eax
jmp 0x4023ed
mov ecx, ebp
mov eax, ebx
test ebp, ebp
jle 0x4023eb
lea esp, [esp]
cmp byte [eax], 0xa
je 0x402427
dec ecx
inc eax
test ecx, ecx
jg 0x4023e0
mov eax, ebp
mov ecx, dword [esp + 0x10]
push 0
push eax
push ebx
push ecx
call sub.WS2_32.dll_send
test eax, eax
jle 0x402409
add ebx, eax
sub ebp, eax
add dword [0x414ae4], eax
mov eax, dword [0x414b08]
test eax, eax
jne 0x40242c
test ebp, ebp
jne 0x40241a
test edi, edi
je 0x402440
add dword [esp + 0x20], 0xffff
jmp 0x402330
sub eax, ebx
inc eax
jmp 0x4023ed
push eax
call fcn.00403a7a
add esp, 4
call fcn.00403db7
mov dword [eax], 0
mov edx, dword [0x415ce4]
mov eax, dword [esp + 0x10]
push edx
push eax
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
jne 0x402140
mov esi, dword [esp + 0x10]
push 2
push esi
call sub.WS2_32.dll_shutdown
push esi
call sub.WS2_32.dll_closesocket
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x34
ret
call sub.WS2_32.dll_WSAGetLastError
push str.select_fuxored
call fcn.004012a0
mov esi, dword [esp + 0x14]
add esp, 4
push 2
push esi
call sub.WS2_32.dll_shutdown
push esi
call sub.WS2_32.dll_closesocket
mov eax, 1
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x34
ret
cmp word [0x414b20], 1
jbe 0x4024bd
push str.net_timeout
call fcn.004012a0
add esp, 4
mov esi, dword [esp + 0x10]
push 2
push esi
call sub.WS2_32.dll_shutdown
push esi
call sub.WS2_32.dll_closesocket
mov ecx, dword [0x415ce4]
push 0
mov dword [ecx], 0
call sub.WS2_32.dll_WSASetLastError
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x34
ret
push str.too_many_output_retries
call fcn.004012a0
add esp, 4
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x34
ret