[RESOLVED] [2008] server/client TCP, help!
hey guys,
Alright so I went to the codebank and used the basic TCP communication.
It dosnt work :(. WHen I click listen on my computer and then go up to my laptop which is connected to a DIFFERENT NETWORK ( i am stealing my neighbours wireless hehe) it dosnt connect.
The error message says:
Quote:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 74.12.133.107:664
My understanding is that IT DOES CONNECT but my server has problems. Anyway read on to what I think might be causing a problem.
I think the problem might lie here:
Code:
listener = New System.Net.Sockets.TcpListener(System.Net.IPAddress.Any, CInt(txtPort.Text)) 'The TcpListener will listen for incoming connections at port 43001
MSDN Says
Quote:
Create a TcpListener using an IPEndPoint, a Local IP address and port number, or just a port number. Specify Any for the local IP address
But none of this is local. Its over the internet.
Secondaly I think you guys should know this, ( i dont know if all the modems do this)
but my highspeed modem gives me a "local" IP. when i do ipconfig it gives me a 192.168.2.1. When I plug this in in to IE, i get a web based modem configuration thing which shows my REAL IP.
could that be a problem?
Re: [2008] server/client TCP, help!
ALright i think i found a solution
http://www.vbforums.com/showthread.php?t=506751
vb Code:
Fixed this!
The problem was that TcpListener can't listen on an external (or WAN) IP. For anyone else who has this problem (with a router):
You need to
1. Have your tcpListener listen on your computer's local IP, and a specified port.
2. Set up your router to forward incoming requests for that port to your computers IP.
3. Have your TcpClient or Socket connect to your WAN IP, and the same port number.
but I dont have a router. its modem to computer directly.
note: like my last post, this laptop is connected through neighbors wireless :)
Re: [2008] server/client TCP, help!
I downloaded a program which allowed me to forward the incoming connection from port xx WAN IP to port xx INTERNAL IP.
The program is called Vista Firewall Control.