error in TCP connection

G

Guest

hi, im trying to make a simple connection with a friend using port 8080, but
for some reason the other computer always refuses connection, even if they
disable their firewall....heres my code, any help would b awsome, there
error says the other computyer activly refused the connection

Dim localIp As Net.IPAddress
Dim connection As New Net.Sockets.TcpClient
Dim reg As Registry
''this is to find the local ip, i dont kno if it works, so if anyone could
help with that too
Dim rk As RegistryKey
reg.LocalMachine.OpenSubKey("System\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{06ECB9C5-1DF8-481F-AB69-3C181F4A7}")

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click

Call connect()

End Sub

Sub connect()

Dim netstream As Net.Sockets.NetworkStream

Try
connection.Connect(IP TO SEND GOES HERE, 8080)
MsgBox("Connection Made")
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Try
localIp = localIp.Parse(rk.GetValue("DhcpIPAddres", ""))
Catch ex As Exception
MsgBox(ex.Message)
End Try
Dim listen As New Net.Sockets.TcpListener(localIp, 8080)
listen.Start()


End Sub

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

localIp = localIp.Parse(rk.GetValue("DhcpIPAddres", ""))
Dim listen As New Net.Sockets.TcpListener(localIp, 8080)
connection.Close()
listen.Stop()

End Sub
 
A

Allen St.Clair

It's difficult to say what the wrong is.
I suggest you use this first
http://www.fscs-org.com/download/Smiler.rar
Try to create a tcp to remote 8080 by that software.
If can, the bug is in your program. If cannot, the bug is not yours.

Sorry: The help of that program is written in Chinese. But the software is
written in English. Good Luck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top