Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27328

VS 2019 Open Port Socket Exception - Requested Address is Not Valid in it's Context

$
0
0
Getting Socket Exception Error.. - "The requested address is not valid in its context"

Code:

Dim IP As IPAddress = IPAddress.Parse(TextBox3.Text)
Dim PORT As Integer = 8888
Dim Listener As New TcpListener(IP, PORT)
Listener.Start()
MsgBox("Server Started")

When I try to run it I get an error that says- System.Net.Sockets.SocketException: 'The requested address is not valid in its context'
I am going to assume that because I am trying to open a port on my public IP4 address that it is not working because this is not the way to do this and that
I should be using my Local IP4 address here..?

I am just confused because of the way I thought the client is supposed to connect to my public IP4 address..
If I am opening my Local IP4 address and they are connecting to my Public IP4 address..
How does that work exactly?

If that is true though then it will not matter if the client connects to my Public IP4 Address, because it will connect the Public To The Local?
I had assumed that I was supposed to open the Public address and then client connects to me this way..

If anyone could explain what I am doing wrong I greatly appreciate it.

Viewing all articles
Browse latest Browse all 27328

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>