dcsimg
Results 1 to 2 of 2

Thread: Cannot connect using TcpClient

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    2

    Cannot connect using TcpClient

    I am very new to programming in vb.net, I have found the following code which I believe should just connect my computer to itself.

    Code:
    Imports System.Net.Sockets
    Imports System.Text
    
    Class CTestTCPClient
        Shared Sub Main()
    
            Dim tcpClient As New System.Net.Sockets.TcpClient
            Console.WriteLine("opened")
            tcpClient.Connect("127.0.0.1", 30320)
            Console.WriteLine("connected")
        End Sub
    End Class
    I get a pop-up "switch2 has stopped working with the following error codes:
    Problem Event Name: CLR20r3
    Problem Signature 01: switch2.exe
    Problem Signature 02: 1.0.0.0
    Problem Signature 03: 4dcd177a
    Problem Signature 04: System
    Problem Signature 05: 2.0.0.0
    Problem Signature 06: 4ca2ba90
    Problem Signature 07: 2ddb
    Problem Signature 08: 1b3
    Problem Signature 09: System.Net.Sockets.Socket
    OS Version: 6.1.7601.2.1.0.256.48
    Locale ID: 1033

    Which I can't make head nor tail of, and can't find any information on the internet. I'm on Windows 7 using Visual Basic 2005 Express

    Any help greatly appreciated.
    Chris

  2. #2

    Re: Cannot connect using TcpClient

    That won't ever work because you don't have a TcpListener open and waiting on port 30320. Windows will refuse the connection unless a program opens up a Listener on that port. Take a look at RattleSnake in my signature; it might be breaking a walnut with a sledgehammer, but it has a client-server communication model.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width