Uploading Files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • govind161986
    New Member
    • Dec 2009
    • 21

    Uploading Files

    When I execute the below code i get the following error "A socket operation was attempted to an unreachable host".

    Code:
    main_sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
    main_ipEndPoint = new IPEndPoint(Dns.GetHostByName(server).AddressList[0], this.port);
    
    main_sock.Connect(main_ipEndPoint);
    Please help me in this regard.

    Thanks and regards,

    Govind
    Last edited by tlhintoq; Jan 5 '10, 03:50 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      When I execute the below code i get the following error "A socket operation was attempted to an unreachable host".
      What exactly do you need help with? The error message is very self explanatory. You tried to establish a connection with a host that can't be reached.

      [Telephone operator recording]
      "The number you have dialed is not a working number. Please check the number and dial again."
      [end recording]

      Comment

      • govind161986
        New Member
        • Dec 2009
        • 21

        #4
        Thanks for your reply.

        But when i execute the code mentioned above in .NET 2.0 it gets executed successfully. I want to integrate it in .NET 1.1. How should i achieve this?

        Thanks and regards,

        Govind

        Comment

        • tlhintoq
          Recognized Expert Specialist
          • Mar 2008
          • 3532

          #5
          I don't know for sure.
          I would guess that you need to study the differences in how this done in 2.0 and 1.1 and make your code compliant with the 7 year old framework. Maybe 1.1 requires additional setup to be done before invoking this and 2.0 handles it quietly behind the scenes for you. Maybe it was just plain broke in 1.1 and fixed in 2.0. Who knows?

          Either that or tell your client that they need to accept the inevitable update to framework 2.

          Remind them that framework 4 is soon to be released and that staying so far behind the times is not in any way helping them. Framework updates are FREE.

          Comment

          • govind161986
            New Member
            • Dec 2009
            • 21

            #6
            Originally posted by tlhintoq
            I don't know for sure.
            I would guess that you need to study the differences in how this done in 2.0 and 1.1 and make your code compliant with the 7 year old framework. Maybe 1.1 requires additional setup to be done before invoking this and 2.0 handles it quietly behind the scenes for you. Maybe it was just plain broke in 1.1 and fixed in 2.0. Who knows?

            Either that or tell your client that they need to accept the inevitable update to framework 2.

            Remind them that framework 4 is soon to be released and that staying so far behind the times is not in any way helping them. Framework updates are FREE.
            Thanks for your reply.

            I need to upload files to a network shared drive in .NET 1.1. Can you please help me in this regard?

            Thanks,

            Govind

            Comment

            • tlhintoq
              Recognized Expert Specialist
              • Mar 2008
              • 3532

              #7
              If it is a shared drive on your network, the just copy the file. It wouldn't be an 'upload'

              System.IO.File. Copy(string Source, string Destination);

              Comment

              Working...