Results 1 to 7 of 7

Thread: [RESOLVED] An address incompatible with the requested protocol was used

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2010
    Posts
    74

    Resolved [RESOLVED] An address incompatible with the requested protocol was used

    how can i solve this problem?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: An address incompatible with the requested protocol was used

    Use an address that is compatible with the requested protocol. For us to tell you any more than that, we'd have to see the code that caused the error, not just the error message.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2010
    Posts
    74

    Re: An address incompatible with the requested protocol was used

    i can't fully understand what you are saying cause i'm just a newbie in vb.net.. here's my code

    Code:
    Imports System.Net.Sockets
    Imports System.Text
    Imports System.Net.IPAddress
    Imports System.Net.IPHostEntry
    Imports System.Net
    
    Public Class Form1
        Dim clientSocket As New System.Net.Sockets.TcpClient()
        Dim serverStream As NetworkStream
        Dim ipAddress As IPAddress = Dns.GetHostEntry("localhost").AddressList(0)
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim serverStream As NetworkStream = clientSocket.GetStream()
            Dim outStream As Byte() = _
            System.Text.Encoding.ASCII.GetBytes("Message from Client$")
            serverStream.Write(outStream, 0, outStream.Length)
            serverStream.Flush()
    
            Dim inStream(10024) As Byte
            serverStream.Read(inStream, 0, CInt(clientSocket.ReceiveBufferSize))
            Dim returndata As String = _
            System.Text.Encoding.ASCII.GetString(inStream)
            MsgBox("Data from Server : " + returndata)
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            MsgBox("Client Started")
            clientSocket.Connect(ipAddress, 8080)
            TextBox1.Text = "Client Socket Program - Server Connected ..."
        End Sub
    
        Sub msg(ByVal mesg As String)
            TextBox1.Text = TextBox1.Text + Environment.NewLine + " >> " + mesg
        End Sub
    End Class
    can you please tell me what to do? i'm using vista.. ive searched that error in the internet and it says that i'm trying to connect to an IPv6 address / IP without the IPv6 stack installed. i checked the settings of my network connections and i saw that ipv4 and ipv6's checkbox are both checked.. i've tried to install ipv6 on the command prompt.. i typed netsh interface ipv6 install.. but it says that 'the following command was not found: install'

    help please..

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: An address incompatible with the requested protocol was used

    Presumably AddressList(0) is an IPv6 address. If you want to connect to the local machine then you may as well just use IPAddress.Loopback.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Apr 2010
    Posts
    74

    Re: An address incompatible with the requested protocol was used

    finally!!!!!!!!!!!!!

    thanks a lot bro!!!

    great job!

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Apr 2010
    Posts
    74

    Re: [RESOLVED] An address incompatible with the requested protocol was used

    one more question please..

    what if i want to get the ipaddress of another computer? for example, 112.203.80.0 visual studio reads that ipaddress as string so i can't put it in the parameter of tcplistener or socket.connect.. what will i do to convert it to ipadress that the visual studio can read? (not string)

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] An address incompatible with the requested protocol was used

    You need to create an IPAddress object, i.e. an instance of the IPAddress class. Read the documentation for that class and you'll find out how to do that. Always read the relevant documentation first.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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