473,395 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

error in TCP connection

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\CurrentControl Set\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
--
-iwdu15
Nov 21 '05 #1
1 1011
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.

"iwdu15" <iw****@discussions.microsoft.com> wrote in message
news:0D**********************************@microsof t.com...
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\CurrentControl Set\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
--
-iwdu15

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Chris Szabo | last post by:
I've created a data access layer for a .NET web application. I'm using C# and framework 1.1. I'm getting an error from time to time when I close a connection saying: ...
4
by: Troy | last post by:
We recently installed the .Net framework on a windows 2000 server. Shortly after that we experienced intermitant problems running a web based program that accesses an Access 2002 database. The...
2
by: Chuck Ritzke | last post by:
Hi all, I am getting an intermittant error after uploading a project from my development machine. I click on a link which opens an aspx page that, upon page load, reads a very small amount of...
3
by: Adriano | last post by:
Hello, when I try to print something, either DataGrid or from Crystal Report viever the folowing error message appears and cancels printing: Object reference not set to an instance of an...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
2
by: =?Utf-8?B?U3VuaWwgUGFuZGl0YQ==?= | last post by:
Hi All, I have created a VB.Net application that used classic ADO to access the oracle database. I have mentained a persistant connection in it. When i start the application and it works fine....
0
by: mbenedict | last post by:
I am rather new at this code and am attempting to modify existing code to use clob datatypes, which I have never used before. The database tables have been set up for clob data. When trying to use...
1
by: piyushgpt1 | last post by:
My company has a web application running on JBoss-2.4.4_Tomcat-4.0.1. It works fine for a few days, but once or twice in a week, getting the exception :- Error : Runnable did not complete within...
5
by: Cirene | last post by:
I just deployed my new ASP.NET (3.5 FW) site to the hosting company I'm using, webhost4life. NOTE: I HAVE deployed other SQL Server sites to the same account with no issues. Now I'm getting...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.