CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: FTP problem

  1. #1
    Join Date
    Apr 1999
    Posts
    5

    FTP problem



    I have an FTP client server program written in java, both the server and the client are classes that are runnable. The FTP server keeps listening and when a client connection is established, a new class FTPReceiver is created and run in a different thread with the new socket obtained from the connection, while the ServerSocket continues to listen. This FTP program is working fine.

    I wanted do an FTP in another client- server program. So I ran the FTP server class in a thread and tried to carry out the FTP by starting the FTP client in a thread from the counterpart program. But this doesn't seem to work. The first 9140 bytes of the transfer gets lost somewhere. But if I start the FTP client in a new process rather than a thread, it works fine. I am unable to figure out the problem. Can anyone help me.


    JAIKISH

  2. #2
    Join Date
    Mar 1999
    Posts
    22

    Re: One Client application is assigned one port number.



    Hi.


    If you know TCP/IP, you can understand your problem.

    However, this is my guess.

    If we open Internet application, client application will be assigned the port

    number from OS. On the other hand, Server is assigned a well known port.

    Server side TCP or UDP deals with (Source IP address, well known port). This

    means that one server can be access many client by same port becasue

    TCP or UDP figure it out by combination of Source IP address and port #.


    However, at client side, one applicaton will be assigned some port #. If

    we open the same application, OS assigns the other port #.

    If you use the same application by another thread, this must be not controled

    because thread generates process of application.

    That is, process must be done by its each port number. If you generate thread

    in order to generate process, it must be conflict.


    Hope for help.

    -Masaaki Onishi-



  3. #3
    Join Date
    Apr 1999
    Posts
    5

    Re: One Client application is assigned one port number.



    Hi,

    thanx for ur suggestions.I don't think it is a problem with the port numbers as FTP does occur, but in a corrupted fashion (interestingly, the first 9140 bytes are lost somewhere !!!). The following is the method of connection that I adopted in the application that uses the FTP classes. I first want an FTP to be done from the application client program to the server program. So, I try to start the FTP server in the application server program at a certain port number and if I fail, I keep incrementing the portnumber and keep on trying untill I succeed. This starting of the FTPServer is also done in a separate thread. Then I send across the port number on which the FTP server is started to the client program. Now the client application program starts an FTPClient class (in a new thread), connecting to the well known FTP server port number (got from the server program) on the machine running the server application program.


    regards and thanx,

    JAIKISH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured