Binding & connecting using sockets in vb.net
Here is an issue with a socket I am having:

    Public Sub Connect(ByVal server As String, ByVal port As Integer)
            Dim IP As IPAddress = IPAddress.Parse(server)
            Dim EP As IPEndPoint = New IPEndPoint(IP, port)
            sock.Bind(EP)
            sock.Connect(server, port)
        End Sub
The socket is declared like this, at the top of the code:

    Dim sock As Socket

What is wrong here? It says Object reference not set to an instance of an object, which is a NullReferenceException.

Thanks for your help! This is in vb.net by the way, and I have imported the proper namespaces.
Binding & connecting using sockets in vb.net
===

Here is an issue with a socket I am having:

    Public Sub Connect(ByVal server As String, ByVal port As Integer)
            Dim IP As IPAddress = IPAddress.Parse(server)
            Dim EP As IPEndPoint = New IPEndPoint(IP, port)
            sock.Bind(EP)
            sock.Connect(server, port)
        End Sub
The socket is declared like this, at the top of the code:

    Dim sock As Socket

What is wrong here? It says Object reference not set to an instance of an object, which is a NullReferenceException.

Thanks for your help! This is in vb.net by the way, and I have imported the proper namespaces.