Connected server through socket but not able to retrieve files.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nirajjha
    New Member
    • Jul 2007
    • 14

    Connected server through socket but not able to retrieve files.

    hi,
    i am able to connect to server through socket, (using only client side code )
    but not able to retrieve files , i dont able to find files but its there in the server.

    i am getting responce from server that i am connected to that server .
    but still ......

    i have used receive method for retrieving files.


    can any body help..
    Last edited by nirajjha; Jul 4 '07, 11:23 AM. Reason: for modification
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, nirajjha. Welcome to TSDN!

    What protocol are you using?

    Comment

    • nirajjha
      New Member
      • Jul 2007
      • 14

      #3
      Originally posted by pbmods
      Heya, nirajjha. Welcome to TSDN!

      What protocol are you using?


      I am using FTP.......

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        How are you connecting to the server?

        Are you using an FTP program? Which program, and what operating system are you using?

        Are you writing a program? Which programming language are you using?

        Comment

        • nirajjha
          New Member
          • Jul 2007
          • 14

          #5
          Originally posted by pbmods
          How are you connecting to the server?

          Are you using an FTP program? Which program, and what operating system are you using?

          Are you writing a program? Which programming language are you using?

          Hi ,
          thanks yaar for repling

          I am using socket for connection
          IPAddress[] Ips = Dns.GetHostAddr esses("")
          Socket s = new Socket(AddressF amily.InterNetw ork, SocketType.Stre am, ProtocolType.IP );
          s.connect(ipadd ress,port);

          and using " poll " method to verify whether it is connected or not.
          it is showing me connected.

          and i defined 2 method.
          first to send request : By sendrequest() method
          second to retrieve responce fron server :-.By GetResponce() method ;


          there only i am sending username and
          password like ...
          string response;
          SendRequest(s, "LOGIN" + " " + "username " + " password" );
          sending login command or by
          below code .
          SendRequest(s, "USER" + " " + "username") ;
          response = GetResponce(s);
          SendRequest(s, "PWD" + " " + "password") ;
          response = GetResponce(s);

          i am slightly confused, can u briefly explain me what is the difference between
          socket and ftp ........confuse d.....

          and what is the real problem in my code, i am missing some thing.

          i am using window 2000 server....

          Comment

          • pbmods
            Recognized Expert Expert
            • Apr 2007
            • 5821

            #6
            Heya, nirajjha.

            I'll go ahead and move your thread to the .NET Forum, where one of our resident .NET experts will be able to help you out.

            Comment

            • Plater
              Recognized Expert Expert
              • Apr 2007
              • 7872

              #7
              FTP uses one port for talking and another for data transfer.
              You either have to handle doing Passive FTP (everything on one port) or check the FTP specifications for how to handle the 2nd socket-port setup.

              The differences between FTP and sockets are huge. FTP is a protocol, a socket is an implementation of Berkley Sockets used for communicating with other computers. I recomend a quick Wiki check of the subjects if you are interested.

              Comment

              • nirajjha
                New Member
                • Jul 2007
                • 14

                #8
                add

                Originally posted by Plater
                FTP uses one port for talking and another for data transfer.
                You either have to handle doing Passive FTP (everything on one port) or check the FTP specifications for how to handle the 2nd socket-port setup.

                The differences between FTP and sockets are huge. FTP is a protocol, a socket is an implementation of Berkley Sockets used for communicating with other computers. I recomend a quick Wiki check of the subjects if you are interested.
                Thank dude for replying .

                i am able to retrieve files by using ftpwebrequest class.i have done that today.

                but as specified in this thread, i am using socket for connection...ye s i have succeeded in establishing connection with server.but i am not able to find any file..there .
                tell me one thing, i have communicating a server through its ipaddress and port number ..but how to send Username and password...to that server using socket that i have already established(con nection).


                yes i have used passive connetion .

                is there any command used in sockets for sending username and password.....


                any help i appreciate it.
                Last edited by nirajjha; Jul 5 '07, 04:06 PM. Reason: modification

                Comment

                • Plater
                  Recognized Expert Expert
                  • Apr 2007
                  • 7872

                  #9
                  There are commands to send/receive data as bytes.
                  You will have to convert your strings to bytes before sending.
                  I recomend using: Encoding.ASCII. GetBytes()

                  Comment

                  • nirajjha
                    New Member
                    • Jul 2007
                    • 14

                    #10
                    Originally posted by Plater
                    There are commands to send/receive data as bytes.
                    You will have to convert your strings to bytes before sending.
                    I recomend using: Encoding.ASCII. GetBytes()


                    hi,

                    i want to know what is maximum speed that can be achieved by using sockets.i have achieved 20Mega bytes in 4 min 30 seconds.
                    or

                    Any other protocol is there where u can achieve more than sockets.

                    plz i want to know it.....

                    Comment

                    • Plater
                      Recognized Expert Expert
                      • Apr 2007
                      • 7872

                      #11
                      "Sockets" is not a protocol. For the most part, speed is based on the physical connection between the endpoints. Talking through a broadband connection to a computer hundreds of miles away will probably be faster then talking to a computer down the street if you both have 28.8kbaud modems.

                      I really suggest reading through wiki articles about these kinds of things so you have a better understanding of their concepts

                      Comment

                      • nirajjha
                        New Member
                        • Jul 2007
                        • 14

                        #12
                        Originally posted by Plater
                        "Sockets" is not a protocol. For the most part, speed is based on the physical connection between the endpoints. Talking through a broadband connection to a computer hundreds of miles away will probably be faster then talking to a computer down the street if you both have 28.8kbaud modems.

                        I really suggest reading through wiki articles about these kinds of things so you have a better understanding of their concepts

                        Thanks a Lot for your guidance.

                        my program is working fine now......both using socket and ftp.
                        as a fresher this is nice achievement for me.

                        Ur last post was really helpful .......Thanks.

                        one more question in my mind, suppose if i am using threads(differe nt threads for different files to be downloaded at same time.) for downloading .will it affect download speed.

                        Comment

                        • Plater
                          Recognized Expert Expert
                          • Apr 2007
                          • 7872

                          #13
                          Yes, just like in everyday use, you have a finite amount of bandwidth. When it's used up, it's used up. If you're downloading one file from the internet, trying to download a bunch more will slow the first one down.

                          Only so much data can flow through at any givin time (throughput)

                          Comment

                          Working...