FTP file upload failed.

Hello All,
I am new, in this group. I came to know about this Experts group , through Google search.
I am facing issues in FTP client.
I am trying to write a new FTP client in C++ in Linux.
Able to log in at FTP server , through my C/C++ client. While uploading file (using "STOR" command) , I am getting "425 Can't build data connection", after that client successfully logs out.
I have opened socket on port 21 , on which , able to send user name and password , on success , I am sending "STOR temp.txt" command on same socket same port, it tries for some time and then gives error "425 Can't build data connection" , with no other information.

I read a good article "Concepts of FTP" on group... that is the reason I joined the group. I look forward, for not only resolving my issue , but also knowledge wise growth of mine.

Hi Shabbir,
thanks for the quick reply. But its not the case, my client and server are running in same domain. Previously , i was getting error "permission denied" , but it was solved , after changing folder rights on server side. as far I understood FTP, server uses 2 ports for communication , one for control and other for data transfer, but if I use to different ports actually in code, its not able to even log in... so confusion is, Should I use same port and same socket to transfer file as used for log i or should i use different ports and sockets for log in and file upload....