Socket Exception in System.dll


#1

Hi,

i spend some time converting the C# sample to vb.net and all runs fine but at the end i get a wired error, no matter if i call
ClusterHelper.RemoveBucket(“default”)
ClusterHelper.Close()

Any idea what might cause this and if so how to fix ?

Exception thrown: ‘System.Net.Sockets.SocketException’ in System.dll
The thread 0x6bf0 has exited with code 0 (0x0).
Exception thrown: ‘System.Net.Sockets.SocketException’ in System.dll
The thread 0x3dcc has exited with code 0 (0x0).
Exception thrown: ‘System.Net.Sockets.SocketException’ in System.dll
The thread 0x322c has exited with code 0 (0x0).
Exception thrown: ‘System.Net.Sockets.SocketException’ in System.dll
The thread 0x7788 has exited with code 0 (0x0).
The thread 0x91c0 has exited with code 0 (0x0).
Exception thrown: ‘System.Threading.Tasks.TaskCanceledException’ in mscorlib.dll


#2

Hi @aponnath

Converting the sample code from here, I ended up with this code which works for me. Note I created a custom config so I could override the server IP.

    dim config = New ClientConfiguration With
    {
        .Servers = New List(Of Uri) From { new Uri("http://10.112.161.101") }
    }
    
    Dim cluster = New Cluster(config)

    Using bucket As IBucket = cluster.OpenBucket("default")
        
        Dim document = New Document(Of UserData) With
        {
            .Id = "Hello",
            .Content = New UserData With{.Name = "couchbase"}
        }

        Dim upsertResult = bucket.Upsert(document)
        If upsertResult.Success

            Dim getResult = bucket.Get (Of UserData)("Hello")
            Console.WriteLine(String.Format("{0} {1}", getResult.Id, getResult.Value.Name))

        End If

    End Using  
        
    Console.ReadKey(true)

My data class looks like this:

Public Class UserData

  Public Property Name As string

End Class

If that doesn’t work for you, after updating to a valid server address (eg ‘http://localhost’), you may need to verify connectivity between your application and the server. Are you running Couchbase server locally or over a network?

Mike