473,385 Members | 1,838 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,385 software developers and data experts.

TCP Client question/problem

I wrote a simple client / server app (nothing major, just sends text) it
works fine locally on the same system, but once i move the client to a
remote system it errors and gives me "No connection could be made because
the target machine actively refused it" what exactly does that mean? the
targed machine actively refused it? i have port forwarding set up correctly
on ISA server to forward it to the server maching...
Nov 20 '05 #1
12 2002
Post the code please......

"Brian Henry" <NO************@adelphia.net> wrote in message
news:uY**************@TK2MSFTNGP10.phx.gbl...
I wrote a simple client / server app (nothing major, just sends text) it
works fine locally on the same system, but once i move the client to a
remote system it errors and gives me "No connection could be made because
the target machine actively refused it" what exactly does that mean? the
targed machine actively refused it? i have port forwarding set up correctly on ISA server to forward it to the server maching...

Nov 20 '05 #2
On 2003-11-09, Brian Henry <NO************@adelphia.net> wrote:
I wrote a simple client / server app (nothing major, just sends text) it
works fine locally on the same system, but once i move the client to a
remote system it errors and gives me "No connection could be made because
the target machine actively refused it" what exactly does that mean? the
targed machine actively refused it? i have port forwarding set up correctly
on ISA server to forward it to the server maching...


It means that you are attempting to connect to the wrong address/port...
You may want to post a bit of code. I would suggest the code that you
use in the client to connect to the server, and probably the snippet in
the server you use to start listening.
--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #3
Check the address where the client try to connect.. it should be the network
address of the server machine, not 127.0.0.1 or what ever was first time
when used on hte same machine as the server

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Brian Henry" <NO************@adelphia.net> wrote in message
news:uY**************@TK2MSFTNGP10.phx.gbl...
I wrote a simple client / server app (nothing major, just sends text) it
works fine locally on the same system, but once i move the client to a
remote system it errors and gives me "No connection could be made because
the target machine actively refused it" what exactly does that mean? the
targed machine actively refused it? i have port forwarding set up correctly on ISA server to forward it to the server maching...

Nov 20 '05 #4
========== client ============

==========================

Try

Dim tcpClient As New System.Net.Sockets.TcpClient

tcpClient.Connect("24.50.177.229", 9000)

Dim networkStream As NetworkStream = tcpClient.GetStream

If networkStream.CanWrite Then

Try

Dim sendBytes As Byte() = Encoding.ASCII.GetBytes("someone went to test
website")

networkStream.Write(sendBytes, 0, sendBytes.Length)

Catch ex As Exception

End Try

End If

Catch ex As Exception

Response.Write(ex.Message)

Response.Write(ex.Source)

Response.Write(ex.HelpLink)

End Try
======= server ==============
Const tcpPort As Integer = 9000
Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")
Dim tcpListener As New Net.Sockets.TcpListener(localAddr, tcpPort)
Dim listnerThread As New Thread(AddressOf ListenForData)

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

Me.txtOutputMessages.Text += "Starting listener..." &
ControlChars.CrLf
tcpListener.Start()
Me.txtOutputMessages.Text += "Listener started, waiting for
connection..." & ControlChars.CrLf
Application.DoEvents()
listnerThread.Start()

End Sub

Private Sub ListenForData()
Me.txtOutputMessages.Text += "Thread started, waiting for data..." &
ControlChars.CrLf
Try
Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient
Me.txtOutputMessages.Text += "Connection Accepted..." &
ControlChars.CrLf
Dim networkStream As NetworkStream = tcpClient.GetStream()
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
Do
networkStream.Read(bytes, 0,
CInt(tcpClient.ReceiveBufferSize))
If networkStream.CanRead Then
Me.txtOutputMessages.Text += "Client Sent: " &
Encoding.ASCII.GetString(bytes) & ControlChars.CrLf
End If

Loop
Catch ex As Exception
Me.txtOutputMessages.Text = ex.Message
tcpListener.Stop()
End Try

End Sub

==========================
Nov 20 '05 #5
Try to Change this line's IP address to an address on the internet or the
address of the machine on the network...

Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")

"Brian Henry" <NO************@adelphia.net> wrote in message
news:eT**************@TK2MSFTNGP10.phx.gbl...
========== client ============

==========================

Try

Dim tcpClient As New System.Net.Sockets.TcpClient

tcpClient.Connect("24.50.177.229", 9000)

Dim networkStream As NetworkStream = tcpClient.GetStream

If networkStream.CanWrite Then

Try

Dim sendBytes As Byte() = Encoding.ASCII.GetBytes("someone went to test
website")

networkStream.Write(sendBytes, 0, sendBytes.Length)

Catch ex As Exception

End Try

End If

Catch ex As Exception

Response.Write(ex.Message)

Response.Write(ex.Source)

Response.Write(ex.HelpLink)

End Try
======= server ==============
Const tcpPort As Integer = 9000
Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")
Dim tcpListener As New Net.Sockets.TcpListener(localAddr, tcpPort)
Dim listnerThread As New Thread(AddressOf ListenForData)

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

Me.txtOutputMessages.Text += "Starting listener..." &
ControlChars.CrLf
tcpListener.Start()
Me.txtOutputMessages.Text += "Listener started, waiting for
connection..." & ControlChars.CrLf
Application.DoEvents()
listnerThread.Start()

End Sub

Private Sub ListenForData()
Me.txtOutputMessages.Text += "Thread started, waiting for data..." & ControlChars.CrLf
Try
Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient
Me.txtOutputMessages.Text += "Connection Accepted..." &
ControlChars.CrLf
Dim networkStream As NetworkStream = tcpClient.GetStream()
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
Do
networkStream.Read(bytes, 0,
CInt(tcpClient.ReceiveBufferSize))
If networkStream.CanRead Then
Me.txtOutputMessages.Text += "Client Sent: " &
Encoding.ASCII.GetString(bytes) & ControlChars.CrLf
End If

Loop
Catch ex As Exception
Me.txtOutputMessages.Text = ex.Message
tcpListener.Stop()
End Try

End Sub

==========================

Nov 20 '05 #6
tried that, and did not work still...
"scorpion53061" <sc****************************@yahoo.com> wrote in message
news:us*************@TK2MSFTNGP09.phx.gbl...
Try to Change this line's IP address to an address on the internet or the
address of the machine on the network...

Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")

"Brian Henry" <NO************@adelphia.net> wrote in message
news:eT**************@TK2MSFTNGP10.phx.gbl...
========== client ============

==========================

Try

Dim tcpClient As New System.Net.Sockets.TcpClient

tcpClient.Connect("24.50.177.229", 9000)

Dim networkStream As NetworkStream = tcpClient.GetStream

If networkStream.CanWrite Then

Try

Dim sendBytes As Byte() = Encoding.ASCII.GetBytes("someone went to test
website")

networkStream.Write(sendBytes, 0, sendBytes.Length)

Catch ex As Exception

End Try

End If

Catch ex As Exception

Response.Write(ex.Message)

Response.Write(ex.Source)

Response.Write(ex.HelpLink)

End Try
======= server ==============
Const tcpPort As Integer = 9000
Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")
Dim tcpListener As New Net.Sockets.TcpListener(localAddr, tcpPort)
Dim listnerThread As New Thread(AddressOf ListenForData)

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

Me.txtOutputMessages.Text += "Starting listener..." &
ControlChars.CrLf
tcpListener.Start()
Me.txtOutputMessages.Text += "Listener started, waiting for
connection..." & ControlChars.CrLf
Application.DoEvents()
listnerThread.Start()

End Sub

Private Sub ListenForData()
Me.txtOutputMessages.Text += "Thread started, waiting for
data..." &
ControlChars.CrLf
Try
Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient
Me.txtOutputMessages.Text += "Connection Accepted..." &
ControlChars.CrLf
Dim networkStream As NetworkStream = tcpClient.GetStream()
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
Do
networkStream.Read(bytes, 0,
CInt(tcpClient.ReceiveBufferSize))
If networkStream.CanRead Then
Me.txtOutputMessages.Text += "Client Sent: " &
Encoding.ASCII.GetString(bytes) & ControlChars.CrLf
End If

Loop
Catch ex As Exception
Me.txtOutputMessages.Text = ex.Message
tcpListener.Stop()
End Try

End Sub

==========================


Nov 20 '05 #7
What is the address you are port forwarding 9000 to? Is it the same as the
server IP address?

"Brian Henry" <NO************@adelphia.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
tried that, and did not work still...
"scorpion53061" <sc****************************@yahoo.com> wrote in message news:us*************@TK2MSFTNGP09.phx.gbl...
Try to Change this line's IP address to an address on the internet or the address of the machine on the network...

Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")

"Brian Henry" <NO************@adelphia.net> wrote in message
news:eT**************@TK2MSFTNGP10.phx.gbl...
========== client ============

==========================

Try

Dim tcpClient As New System.Net.Sockets.TcpClient

tcpClient.Connect("24.50.177.229", 9000)

Dim networkStream As NetworkStream = tcpClient.GetStream

If networkStream.CanWrite Then

Try

Dim sendBytes As Byte() = Encoding.ASCII.GetBytes("someone went to test website")

networkStream.Write(sendBytes, 0, sendBytes.Length)

Catch ex As Exception

End Try

End If

Catch ex As Exception

Response.Write(ex.Message)

Response.Write(ex.Source)

Response.Write(ex.HelpLink)

End Try
======= server ==============
Const tcpPort As Integer = 9000
Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")
Dim tcpListener As New Net.Sockets.TcpListener(localAddr, tcpPort)
Dim listnerThread As New Thread(AddressOf ListenForData)

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

Me.txtOutputMessages.Text += "Starting listener..." &
ControlChars.CrLf
tcpListener.Start()
Me.txtOutputMessages.Text += "Listener started, waiting for
connection..." & ControlChars.CrLf
Application.DoEvents()
listnerThread.Start()

End Sub

Private Sub ListenForData()
Me.txtOutputMessages.Text += "Thread started, waiting for

data..."
&
ControlChars.CrLf
Try
Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient
Me.txtOutputMessages.Text += "Connection Accepted..." &
ControlChars.CrLf
Dim networkStream As NetworkStream = tcpClient.GetStream()
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
Do
networkStream.Read(bytes, 0,
CInt(tcpClient.ReceiveBufferSize))
If networkStream.CanRead Then
Me.txtOutputMessages.Text += "Client Sent: " &
Encoding.ASCII.GetString(bytes) & ControlChars.CrLf
End If

Loop
Catch ex As Exception
Me.txtOutputMessages.Text = ex.Message
tcpListener.Stop()
End Try

End Sub

==========================



Nov 20 '05 #8
Hi Brain,
SO you know I am trying to connect to you at the ip you gave.....
I get the error you are desciribing thus far.....
I did a ping of your the port(ny-northtonawanda2a-485.buf.adelphia.net) you
are using and it is saying that there is a 100 percent packet loss which
means that port is not being reached...lets try another port.....

"Brian Henry" <NO************@adelphia.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
tried that, and did not work still...
"scorpion53061" <sc****************************@yahoo.com> wrote in message news:us*************@TK2MSFTNGP09.phx.gbl...
Try to Change this line's IP address to an address on the internet or the address of the machine on the network...

Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")

"Brian Henry" <NO************@adelphia.net> wrote in message
news:eT**************@TK2MSFTNGP10.phx.gbl...
========== client ============

==========================

Try

Dim tcpClient As New System.Net.Sockets.TcpClient

tcpClient.Connect("24.50.177.229", 9000)

Dim networkStream As NetworkStream = tcpClient.GetStream

If networkStream.CanWrite Then

Try

Dim sendBytes As Byte() = Encoding.ASCII.GetBytes("someone went to test website")

networkStream.Write(sendBytes, 0, sendBytes.Length)

Catch ex As Exception

End Try

End If

Catch ex As Exception

Response.Write(ex.Message)

Response.Write(ex.Source)

Response.Write(ex.HelpLink)

End Try
======= server ==============
Const tcpPort As Integer = 9000
Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")
Dim tcpListener As New Net.Sockets.TcpListener(localAddr, tcpPort)
Dim listnerThread As New Thread(AddressOf ListenForData)

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

Me.txtOutputMessages.Text += "Starting listener..." &
ControlChars.CrLf
tcpListener.Start()
Me.txtOutputMessages.Text += "Listener started, waiting for
connection..." & ControlChars.CrLf
Application.DoEvents()
listnerThread.Start()

End Sub

Private Sub ListenForData()
Me.txtOutputMessages.Text += "Thread started, waiting for

data..."
&
ControlChars.CrLf
Try
Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient
Me.txtOutputMessages.Text += "Connection Accepted..." &
ControlChars.CrLf
Dim networkStream As NetworkStream = tcpClient.GetStream()
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
Do
networkStream.Read(bytes, 0,
CInt(tcpClient.ReceiveBufferSize))
If networkStream.CanRead Then
Me.txtOutputMessages.Text += "Client Sent: " &
Encoding.ASCII.GetString(bytes) & ControlChars.CrLf
End If

Loop
Catch ex As Exception
Me.txtOutputMessages.Text = ex.Message
tcpListener.Stop()
End Try

End Sub

==========================



Nov 20 '05 #9
strangely that isnt my hostname... mine is pa-indiana.adelphia.net... I
wonder id adelphia is haveign problems ...
"scorpion53061" <sc****************************@yahoo.com> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
Hi Brain,
SO you know I am trying to connect to you at the ip you gave.....
I get the error you are desciribing thus far.....
I did a ping of your the port(ny-northtonawanda2a-485.buf.adelphia.net) you are using and it is saying that there is a 100 percent packet loss which
means that port is not being reached...lets try another port.....

"Brian Henry" <NO************@adelphia.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
tried that, and did not work still...
"scorpion53061" <sc****************************@yahoo.com> wrote in

message
news:us*************@TK2MSFTNGP09.phx.gbl...
Try to Change this line's IP address to an address on the internet or the address of the machine on the network...

Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")

"Brian Henry" <NO************@adelphia.net> wrote in message
news:eT**************@TK2MSFTNGP10.phx.gbl...
> ========== client ============
>
>
>
>
>
> ==========================
>
> Try
>
> Dim tcpClient As New System.Net.Sockets.TcpClient
>
> tcpClient.Connect("24.50.177.229", 9000)
>
> Dim networkStream As NetworkStream = tcpClient.GetStream
>
> If networkStream.CanWrite Then
>
> Try
>
> Dim sendBytes As Byte() = Encoding.ASCII.GetBytes("someone went to test > website")
>
> networkStream.Write(sendBytes, 0, sendBytes.Length)
>
> Catch ex As Exception
>
> End Try
>
> End If
>
> Catch ex As Exception
>
> Response.Write(ex.Message)
>
> Response.Write(ex.Source)
>
> Response.Write(ex.HelpLink)
>
> End Try
>
>
> ======= server ==============
> Const tcpPort As Integer = 9000
> Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1") > Dim tcpListener As New Net.Sockets.TcpListener(localAddr, tcpPort) > Dim listnerThread As New Thread(AddressOf ListenForData)
>
> Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>
> Me.txtOutputMessages.Text += "Starting listener..." &
> ControlChars.CrLf
> tcpListener.Start()
> Me.txtOutputMessages.Text += "Listener started, waiting for
> connection..." & ControlChars.CrLf
> Application.DoEvents()
> listnerThread.Start()
>
>
>
> End Sub
>
> Private Sub ListenForData()
> Me.txtOutputMessages.Text += "Thread started, waiting for

data..."
&
> ControlChars.CrLf
> Try
> Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient
> Me.txtOutputMessages.Text += "Connection Accepted..." &
> ControlChars.CrLf
> Dim networkStream As NetworkStream = tcpClient.GetStream() > Dim bytes(tcpClient.ReceiveBufferSize) As Byte
> Do
> networkStream.Read(bytes, 0,
> CInt(tcpClient.ReceiveBufferSize))
> If networkStream.CanRead Then
> Me.txtOutputMessages.Text += "Client Sent: " &
> Encoding.ASCII.GetString(bytes) & ControlChars.CrLf
> End If
>
> Loop
> Catch ex As Exception
> Me.txtOutputMessages.Text = ex.Message
> tcpListener.Stop()
> End Try
>
> End Sub
>
> ==========================
>
>



Nov 20 '05 #10
I just tried a ping here and trace rout, and my one returned
pa-indiana2b-229.pit.adelphia.net as the host and 100% packet going through
here... I wonder what is up, maybe it's an ISP problem causeing my head
aches... thanks for checking in on that for me.
"scorpion53061" <sc****************************@yahoo.com> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
Hi Brain,
SO you know I am trying to connect to you at the ip you gave.....
I get the error you are desciribing thus far.....
I did a ping of your the port(ny-northtonawanda2a-485.buf.adelphia.net) you are using and it is saying that there is a 100 percent packet loss which
means that port is not being reached...lets try another port.....

"Brian Henry" <NO************@adelphia.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
tried that, and did not work still...
"scorpion53061" <sc****************************@yahoo.com> wrote in

message
news:us*************@TK2MSFTNGP09.phx.gbl...
Try to Change this line's IP address to an address on the internet or the address of the machine on the network...

Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")

"Brian Henry" <NO************@adelphia.net> wrote in message
news:eT**************@TK2MSFTNGP10.phx.gbl...
> ========== client ============
>
>
>
>
>
> ==========================
>
> Try
>
> Dim tcpClient As New System.Net.Sockets.TcpClient
>
> tcpClient.Connect("24.50.177.229", 9000)
>
> Dim networkStream As NetworkStream = tcpClient.GetStream
>
> If networkStream.CanWrite Then
>
> Try
>
> Dim sendBytes As Byte() = Encoding.ASCII.GetBytes("someone went to test > website")
>
> networkStream.Write(sendBytes, 0, sendBytes.Length)
>
> Catch ex As Exception
>
> End Try
>
> End If
>
> Catch ex As Exception
>
> Response.Write(ex.Message)
>
> Response.Write(ex.Source)
>
> Response.Write(ex.HelpLink)
>
> End Try
>
>
> ======= server ==============
> Const tcpPort As Integer = 9000
> Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1") > Dim tcpListener As New Net.Sockets.TcpListener(localAddr, tcpPort) > Dim listnerThread As New Thread(AddressOf ListenForData)
>
> Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>
> Me.txtOutputMessages.Text += "Starting listener..." &
> ControlChars.CrLf
> tcpListener.Start()
> Me.txtOutputMessages.Text += "Listener started, waiting for
> connection..." & ControlChars.CrLf
> Application.DoEvents()
> listnerThread.Start()
>
>
>
> End Sub
>
> Private Sub ListenForData()
> Me.txtOutputMessages.Text += "Thread started, waiting for

data..."
&
> ControlChars.CrLf
> Try
> Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient
> Me.txtOutputMessages.Text += "Connection Accepted..." &
> ControlChars.CrLf
> Dim networkStream As NetworkStream = tcpClient.GetStream() > Dim bytes(tcpClient.ReceiveBufferSize) As Byte
> Do
> networkStream.Read(bytes, 0,
> CInt(tcpClient.ReceiveBufferSize))
> If networkStream.CanRead Then
> Me.txtOutputMessages.Text += "Client Sent: " &
> Encoding.ASCII.GetString(bytes) & ControlChars.CrLf
> End If
>
> Loop
> Catch ex As Exception
> Me.txtOutputMessages.Text = ex.Message
> tcpListener.Stop()
> End Try
>
> End Sub
>
> ==========================
>
>



Nov 20 '05 #11
No problem ........if you want to do some testing let me know as i have the
client sample that I think is pretty similar to yours I cna try here.

"Brian Henry" <NO************@adelphia.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I just tried a ping here and trace rout, and my one returned
pa-indiana2b-229.pit.adelphia.net as the host and 100% packet going through here... I wonder what is up, maybe it's an ISP problem causeing my head
aches... thanks for checking in on that for me.
"scorpion53061" <sc****************************@yahoo.com> wrote in message news:Ob**************@TK2MSFTNGP10.phx.gbl...
Hi Brain,
SO you know I am trying to connect to you at the ip you gave.....
I get the error you are desciribing thus far.....
I did a ping of your the port(ny-northtonawanda2a-485.buf.adelphia.net)

you
are using and it is saying that there is a 100 percent packet loss which
means that port is not being reached...lets try another port.....

"Brian Henry" <NO************@adelphia.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
tried that, and did not work still...
"scorpion53061" <sc****************************@yahoo.com> wrote in

message
news:us*************@TK2MSFTNGP09.phx.gbl...
> Try to Change this line's IP address to an address on the internet or
the
> address of the machine on the network...
>
> Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")
>
> "Brian Henry" <NO************@adelphia.net> wrote in message
> news:eT**************@TK2MSFTNGP10.phx.gbl...
> > ========== client ============
> >
> >
> >
> >
> >
> > ==========================
> >
> > Try
> >
> > Dim tcpClient As New System.Net.Sockets.TcpClient
> >
> > tcpClient.Connect("24.50.177.229", 9000)
> >
> > Dim networkStream As NetworkStream = tcpClient.GetStream
> >
> > If networkStream.CanWrite Then
> >
> > Try
> >
> > Dim sendBytes As Byte() = Encoding.ASCII.GetBytes("someone went to

test
> > website")
> >
> > networkStream.Write(sendBytes, 0, sendBytes.Length)
> >
> > Catch ex As Exception
> >
> > End Try
> >
> > End If
> >
> > Catch ex As Exception
> >
> > Response.Write(ex.Message)
> >
> > Response.Write(ex.Source)
> >
> > Response.Write(ex.HelpLink)
> >
> > End Try
> >
> >
> > ======= server ==============
> > Const tcpPort As Integer = 9000
> > Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1") > > Dim tcpListener As New Net.Sockets.TcpListener(localAddr, tcpPort) > > Dim listnerThread As New Thread(AddressOf ListenForData)
> >
> > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e
As > > System.EventArgs) Handles MyBase.Load
> >
> > Me.txtOutputMessages.Text += "Starting listener..." &
> > ControlChars.CrLf
> > tcpListener.Start()
> > Me.txtOutputMessages.Text += "Listener started, waiting for > > connection..." & ControlChars.CrLf
> > Application.DoEvents()
> > listnerThread.Start()
> >
> >
> >
> > End Sub
> >
> > Private Sub ListenForData()
> > Me.txtOutputMessages.Text += "Thread started, waiting for
data..."
> &
> > ControlChars.CrLf
> > Try
> > Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient > > Me.txtOutputMessages.Text += "Connection Accepted..." & > > ControlChars.CrLf
> > Dim networkStream As NetworkStream =

tcpClient.GetStream() > > Dim bytes(tcpClient.ReceiveBufferSize) As Byte
> > Do
> > networkStream.Read(bytes, 0,
> > CInt(tcpClient.ReceiveBufferSize))
> > If networkStream.CanRead Then
> > Me.txtOutputMessages.Text += "Client Sent: " &
> > Encoding.ASCII.GetString(bytes) & ControlChars.CrLf
> > End If
> >
> > Loop
> > Catch ex As Exception
> > Me.txtOutputMessages.Text = ex.Message
> > tcpListener.Stop()
> > End Try
> >
> > End Sub
> >
> > ==========================
> >
> >
>
>



Nov 20 '05 #12

Have you tried changing the line from:

Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("127.0.0.1")

to

Dim localAddr As Net.IPAddress = Net.IPAddress.Parse("0.0.0.0")

This tells the server to listen on all NIC addresses.

Nov 20 '05 #13

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

Similar topics

17
by: middletree | last post by:
I have a very tough issue I'm looking for help on re: javascript/css. I see that MS has groups with HDTML in the title, but there are quite a few of them, and they don't seem to get updated very...
1
by: Friends | last post by:
Hello sir, I have a problem in calling a exe from client machine.. This is my Problem there is an exe in client machine i need to call the exe from web page..In that page there will be button if I...
0
by: Vitali Lavrov | last post by:
Hi, I am new to database development so my question may seem trivial. Here is the problem: I have an MS Access database file which can be updated by more than one client application (more...
11
by: Timothy Shih | last post by:
Hi, I am having a freezing issue with my application. My application serves several remotable objects, all of which must be initialized before their use. Furthermore, some of them depend on each...
2
by: R.A. | last post by:
Hi, I have a web service that process a client call. When a client makes a call to the web method the method needs to query some data from a client_A and return the data to the calling client_B....
10
by: Ben | last post by:
Hi, I made an application in classic asp (reservation of books and video stuffs for students) and want to migrate to asp.net. The user has to chose a date, then pushung on a submit button. The...
5
by: B1ackwater | last post by:
We've fooled around with Access a bit, but only using the single-user store-bought version. It seems to be a good database - versatile and infinitely programmable - and can apparently be used as a...
5
by: thisis | last post by:
Hi All, Hi All, (this is not the same topic as the my previous topic) What objects/methods/properties does VBScript offer for: Assuring/guarantee/make certain that ASP/VBSCript an ELEMENT...
2
by: Wimpie van Lingen | last post by:
Hey I have some more questions with regards to Remoting in .NET 2. I'm using TCP with the Binary formatter. My solution consists of 4 projects: - Class Library containing the server classes...
27
by: gerrymcc | last post by:
Hello, I'm a php/mysql beginner... Is there any way of making the mysql command line client full-screen? Sometimes it's easier to use the client than go thru php, but since it's only about 80...
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:
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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...
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
jinu1996
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 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.