hi, im new to creating connections to different computers in VB, so i tried a
simple program to connect with a different computer with my program on it. I
enter in the target computer's IP address, and try to connect to port 8080,
but each time it says "Connection Activly Refused" so i have no idea whats
wrong....heres my code
Dim localIp As Net.IPAddress
Dim connection As New Net.Sockets.TcpClient
Dim soc As Sockets.Socket
Private Sub btnconnect_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnconnect.Click
Call connect()
End Sub
Sub connect()
'Dim netstream As Net.Sockets.NetworkStream
Try
connection.Connect(Me.TextBox1.Text, 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
localIp = Dns.GetHostByName(Dns.GetHostName).AddressList.Get Value(0)
End Sub
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
localIp = Dns.GetHostByName(Dns.GetHostName).AddressList.Get Value(0)
Dim listen As New Net.Sockets.TcpListener(localIp, 8080)
connection.Close()
listen.Stop()
soc.Close()
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Dim listen As New Net.Sockets.TcpListener(localIp, 8080)
Dim responsestring As String = "Connected"
listen.Start()
Try
' If soc.Connected = False Then
soc = listen.AcceptSocket
If soc.Connected = True Then
Dim sendBytes As [Byte]() =
Encoding.ASCII.GetBytes(responsestring)
Dim i As Integer = soc.Send(sendBytes)
Timer1.Stop()
End If
'End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
listen.Stop()
End Sub
Private Sub btnlisten_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnlisten.Click
Timer1.Start()
End Sub
any help would b awsome, thanks
--
-iwdu15 4 1122
Did u disable the firewalls on both computers as a test? Can you manually
goto port 8080 on the other PC using the web browser? Where in your code did
the error ocurr?
--
|
+-- Thief_
|
"iwdu15" <iw****@discussions.microsoft.com> wrote in message
news:15**********************************@microsof t.com... hi, im new to creating connections to different computers in VB, so i
tried a simple program to connect with a different computer with my program on it.
I enter in the target computer's IP address, and try to connect to port
8080, but each time it says "Connection Activly Refused" so i have no idea whats wrong....heres my code
Dim localIp As Net.IPAddress Dim connection As New Net.Sockets.TcpClient Dim soc As Sockets.Socket
Private Sub btnconnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnconnect.Click
Call connect()
End Sub
Sub connect()
'Dim netstream As Net.Sockets.NetworkStream Try connection.Connect(Me.TextBox1.Text, 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
localIp =
Dns.GetHostByName(Dns.GetHostName).AddressList.Get Value(0) End Sub
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
localIp =
Dns.GetHostByName(Dns.GetHostName).AddressList.Get Value(0) Dim listen As New Net.Sockets.TcpListener(localIp, 8080) connection.Close() listen.Stop() soc.Close()
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim listen As New Net.Sockets.TcpListener(localIp, 8080) Dim responsestring As String = "Connected"
listen.Start()
Try ' If soc.Connected = False Then soc = listen.AcceptSocket If soc.Connected = True Then Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(responsestring) Dim i As Integer = soc.Send(sendBytes) Timer1.Stop() End If 'End If Catch ex As Exception MsgBox(ex.Message) End Try
listen.Stop()
End Sub
Private Sub btnlisten_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlisten.Click
Timer1.Start()
End Sub
any help would b awsome, thanks
-- -iwdu15
it appears on
connection.Connect(Me.TextBox1.Text, 8080)
and the textbox contains an IP address
Iwdu15
The kind of programs you are making are not simple.
It are hacker style programs for which the most patches are given the last
years on all kind of operating systems.
Even if you succeed than it can be that you have problems tomorrow which
where not yesterday because the port is closed by default or only assigned
for by instance webbrowser request and replies.
I hope this helps,
Cor
lol dont take this in the wrong way, i was by no means trying to create a
hacker program, i was just trying to produce a, relativly, simple program to
communicate with text, like a messeneger program. for instance when i attempt
to connect to the other program, it would come up with i dialog box asking if
they would like to connect or not, but i see this is getting more complex
then i ever imagined This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: LRW |
last post by:
Having a problem getting a onSubmit function to work, to where it popsup a
confirmation depending on which radiobutton is selected.
Here's what I have:
function checkdel() {
if...
|
by: MBW |
last post by:
The following code is for a simple server/client asplication that
allows the user to toggle between serve and or client modes and
send/recieve a message however i am getting an Attribute error on...
|
by: Nils Magnus Englund |
last post by:
Hi,
I've made a HttpModule which deals with user authentication. On the first
request in a users session, it fetches data from a SQL Server using the
following code:
using (SqlConnection...
|
by: Andrew |
last post by:
Sorry about this but I'm new to ADO.NET (finally coming from simple ADO,
bless it) and I'm trying to create a simple three tier program.
Ie, User interface Layer / Business object layer / Database...
|
by: iwdu15 |
last post by:
hey, i was wondering if 1) anyone could tell me whats wrong with my code, i
did a little fixing to the msdn version fo this, or 2) how to make a simple
program that will connect and listen for...
| |
by: Anonymous via the Cypherpunks Tonga Remailer |
last post by:
Hi,
I'm building a simple Object Oriented CMS using PHP5
and the new object model (new to both). I'm looking
for some design advice on how best to integrate the
database class - which creates...
|
by: Brad |
last post by:
Where is the connection string stored for a simple Crystal Report Application.
What I am trying to do is:
1. Create a simple report from a Firebird database using an ODBC connection
2. Need to...
|
by: kj |
last post by:
I'm sure this is a simple, but recurrent, problem for which I can't
hit on a totally satisfactory solution.
As an example, suppose that I want write a module X that performs
some database...
|
by: Blarneystone |
last post by:
Ok, I've got a simple access 97 db. named S_tracking.mdb
It has two tables
1- Jobs
2- Employees
I've set up the references:
Imports System.Data.OleDb
Imports System.IO
Imports System.data
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |