FTP_Client and FTP_Server not working together

I have a Rabbit board (3360) and I am trying to use the sample ftp_client.c as a reference to make my program execute as an FTP client that goes out and retrieves two files from another device. Once those two files have been obtained, I concatenate them together into one file and this file is available for a PC to FTP in to retrieve them from the Rabbit.

The problem that I am having is that both sets of functionality work but not without powering off the rabbit in between.

For example, I can start the rabbit and use Internet Explorer(FTP) on my PC to see the files and download them from the Rabbit to my PC. I then let the Rabbit try to download the two files from the other device and it fails. I then powered off the Rabbit and conducted the same test but in the opposite order. The Rabbit downloads the two files from the external device without any problems. Then I have my PC try to FTP in to the Rabbit and download the concatenated file and it fails.

Here is the output when the PC is unable to get the file from the Rabbit:

==============================================
Calling ftp_client_setup() to download Data.txt…
Looping on ftp_client_tick()…
FTPC: got ‘220 Opto 22 FTP server ready.’
FTPC: sending USER anonymous
FTPC: got ‘331 Please specify the password.’
FTPC: sending PASS
FTPC: got ‘230 User logged in, proceed.’
FTPC: sending TYPE I
FTPC: got ‘200 TYPE Command okay.’
FTPC: sending PORT 192,168,3,100,4,4
FTPC: got ‘200 PORT Command okay.’
FTPC: sending RETR Data.txt
FTPC: got ‘150 File status okay; about to open data connection.’
FTPC: Received 4422 byte file.
FTPC: got ‘226 Closing data connection.’
FTPC: sending QUIT
FTPC: got ‘221 Goodbye.’
FTPC: Closing…
FTPC: done
FTP download completed successfully. 4422 bytes.

Returned from UIO_SetDataBit
FTP: Receiving incoming connection
FTP: replying: 220 Hello! Welcome to ZWorld TinyFTP!
FTP: Line read-> USER foo
FTP: replying: 331 Password required
FTP: Line read-> PASS bar
FTP: replying: 230 User logged in.
FTP: Line read-> CWD /
FTP: replying: 250 OK
FTP: Line read-> TYPE A
FTP: replying: 200 ASCII mode set
FTP: Line read-> PASV
FTP: PASV i/f 0 [0xc0a80364]:1029
FTP: replying: 452 Requested action not taken.


Here is the output when the Rabbit cannot download the two files from the external device:

========================================

Success creating/appending to file ‘Unique01.EMU’. rc = 0
Calling ftp_client_setup() to download QTI.txt…
Looping on ftp_client_tick()…
FTPC: got ‘220 Opto 22 FTP server ready.’
FTPC: sending USER anonymous
FTPC: got ‘331 Please specify the password.’
FTPC: sending PASS
FTPC: got ‘230 User logged in, proceed.’
FTPC: sending TYPE I
FTPC: got ‘200 TYPE Command okay.’
FTPC: cannot listen on data transfer port
TCP socket (C0A80364:0 -> 00000000:0) i/f 0
last: Out of memory
FTPC: bailing out
DH: ABORTED
FTP download failed: status = 2, last code = 200
Calling ftp_client_setup() to download Data.txt…
Looping on ftp_client_tick()…
FTPC: got ‘220 Opto 22 FTP server ready.’
FTPC: sending USER anonymous
FTPC: got ‘331 Please specify the password.’
FTPC: sending PASS
FTPC: got ‘230 User logged in, proceed.’
FTPC: sending TYPE I
FTPC: got ‘200 TYPE Command okay.’
FTPC: cannot listen on data transfer port
TCP socket (C0A80364:0 -> 00000000:0) i/f 0
last: Out of memory
FTPC: bailing out
DH: ABORTED
FTP download failed: status = 2, last code = 200


I have attached a condensed version of the source code. If anyone can tell me anything, I would appreciate it.