CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Posts
    67

    Connecting through URL

    How to connect using url instead of IP address..

    I try using the url instead of IP but the error given is

    The data at the root level is invalid, Line 1 position 1...

    I even try to delete the "http://" and put in "anything.com.sg" but still cannot works the error is still the same...

    Code:
            Try
                tcpC.Connect("http://anything.com.sg", 12345)
            Catch e As Exception
                Console.WriteLine(e.ToString())
            End Try
    Thanks
    Last edited by toytoy; March 8th, 2005 at 12:48 AM.

  2. #2
    Join Date
    Dec 2003
    Location
    St. Cugat - Catalunya
    Posts
    441

    Re: Connecting through URL

    toytoy,
    are you sure your url accepts connections to the specified port?

    I use
    Code:
    tcpClient = New Net.Sockets.TcpClient()
    Try
        tcpClient.Connect("aaa.bbb.cc", 9112)
    Catch m As Exception
        MsgBox(m.ToString())
    End Try
    and it works fine.
    Did it help? rate it.

    The best conversation I had was over forty million years ago ... and that was with a coffee machine.

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