Q: I have an FTP server with username: FTPUSER and password FTPPASSWORD. How can I upload the tcpdump in "real time" I mean I don't have a too big storage to store the dumps, so I need to upload it to a place what I can only reach via FTP. Can I "pipe" somehow the output of the tcpdump to an ftp client that uploads it? [I need to preserve the filenames too: "date +%F-%Hh-%Mm-%Ss-%N.pcap"]

so I'm searching for a solution that doesn't store any tcpdumps locally, rather it uploads the dumps in "real-time".

The OS is OpenWrt 10.03 - the router where the tcpdump runs. [4MB flash on the router, that's why I can't store them locally.]

UPDATE2: there is no SSH connection to the FTP server, just FTP [and FTPES, but that doesn't matter now I think]

-C Before writing a raw packet to a savefile, check whether
the file is currently larger than file_size and, if so, close the current
savefile and open a new one. Savefiles after the first savefile will have
the name specified with the -w flag, with a number after it, starting at 1
and continuing upward. The units of file_size are millions of bytes
1,000,000 bytes, not 1,048,576 bytes).

If you set the size flag to something reasonably small and write a cron script that tests for the existence of new overflow files every minute or so, then uploads the overflowed files via FTP and changes the name before deleting them, you should get what you're looking for.

This setup would still be vulnerable to DOS if something floods the link faster than your cron script can upload the new files, and if you have any SSH capability at all I highly recommend the ssh pipeline trick @Chris Green offers up above.

I think for ftp to work synchronously, it needs to be aware there is this file stream not from the disk but from the program; besides it could get very difficult to accomplish this.

I would suggest you go with sshfs and use ssh/sshfs to mount the remote filesystem with the proper credentials (it is a user land filesystem, so little configuration changes related to fuser on system would do, no super credentials required) then use tcpdump which would constantly dump the packet stream capture into file on the sshfs mounted filesystem.