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

Socket will not accept connections from remote machines

I have created a server application that listens for connections using the
TCPListener class. When I connect to the server using a client on the same
machine as the server, all works as expected. However, when I attempt to
connect to the server application from a client on a remote machine on my
LAN, the connection is refused. I have used Ethereal to confirm that the
request from the client is being received on the server machine. I suspect
that this has something to do with socket or application permissions. Can
anyone point me in the correct direction?

My server application is created using VB.NET 2005 and runs on Windows XP
Home. My client application is running on a Windows XP Professional
machine.

The code to create the listening socket is as follows:

Dim sender As TcpListener = New TcpListener(IPAddress.Parse("127.0.0.1"),
_settings.ClientPort)
Try
sender.Start()
sender.BeginAcceptSocket(AddressOf SenderBeginAcceptEventHandler, sender)
Catch ex As SocketException
MessageBox.Show("Unable to accept connections on port " &
_settings.ClientPort & ".", "Web Proxy", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation)
End Try
Mar 28 '07 #1
3 1931

"Wayne And Miles" <do********@nowhere.comwrote in message
news:46**********************@news.optusnet.com.au ...
>...
The code to create the listening socket is as follows:

Dim sender As TcpListener = New TcpListener(IPAddress.Parse("127.0.0.1"),
_settings.ClientPort)
Try
sender.Start()
....

You are listening only on loopback address, which is not accessible from
outside. Yoe have to listen on external (ethernet) interface, or even
better, on any address (IPAddress.Any - "0.0.0.0"):

New TcpListener(IPAddress.Any, _settings.ClientPort);

Regards,
Goram
Mar 28 '07 #2
Hello,

you are binding to the localhost address.

Try

Dim sender As TcpListener = New TcpListener(IPAddress.Any,
_settings.ClientPort)

Best regards,
Henning Krause
"Wayne And Miles" <do********@nowhere.comwrote in message
news:46**********************@news.optusnet.com.au ...
>I have created a server application that listens for connections using the
TCPListener class. When I connect to the server using a client on the same
machine as the server, all works as expected. However, when I attempt to
connect to the server application from a client on a remote machine on my
LAN, the connection is refused. I have used Ethereal to confirm that the
request from the client is being received on the server machine. I suspect
that this has something to do with socket or application permissions. Can
anyone point me in the correct direction?

My server application is created using VB.NET 2005 and runs on Windows XP
Home. My client application is running on a Windows XP Professional
machine.

The code to create the listening socket is as follows:

Dim sender As TcpListener = New TcpListener(IPAddress.Parse("127.0.0.1"),
_settings.ClientPort)
Try
sender.Start()
sender.BeginAcceptSocket(AddressOf SenderBeginAcceptEventHandler, sender)
Catch ex As SocketException
MessageBox.Show("Unable to accept connections on port " &
_settings.ClientPort & ".", "Web Proxy", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation)
End Try

Mar 28 '07 #3
Many thanks. That was exactly the problem.
"Henning Krause [MVP - Exchange]" <ne***************@this.infinitec.de>
wrote in message news:eQ**************@TK2MSFTNGP03.phx.gbl...
Hello,

you are binding to the localhost address.

Try

Dim sender As TcpListener = New TcpListener(IPAddress.Any,
_settings.ClientPort)

Best regards,
Henning Krause
"Wayne And Miles" <do********@nowhere.comwrote in message
news:46**********************@news.optusnet.com.au ...
>>I have created a server application that listens for connections using the
TCPListener class. When I connect to the server using a client on the
same machine as the server, all works as expected. However, when I
attempt to connect to the server application from a client on a remote
machine on my LAN, the connection is refused. I have used Ethereal to
confirm that the request from the client is being received on the server
machine. I suspect that this has something to do with socket or
application permissions. Can anyone point me in the correct direction?

My server application is created using VB.NET 2005 and runs on Windows XP
Home. My client application is running on a Windows XP Professional
machine.

The code to create the listening socket is as follows:

Dim sender As TcpListener = New TcpListener(IPAddress.Parse("127.0.0.1"),
_settings.ClientPort)
Try
sender.Start()
sender.BeginAcceptSocket(AddressOf SenderBeginAcceptEventHandler, sender)
Catch ex As SocketException
MessageBox.Show("Unable to accept connections on port " &
_settings.ClientPort & ".", "Web Proxy", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation)
End Try


Mar 28 '07 #4

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

Similar topics

11
by: anuradha.k.r | last post by:
hi, i am writing a socket program in python,both client side and server side.I've written the client side which is working perfectly fine(checked it against server program written in C).but as for...
5
by: John Sheppard | last post by:
Hi all, I am not sure that I am posting this in the right group but here it goes anyway. I am new to socket programming and I have been searching on the internet to the questions I am about to pose...
13
by: coloradowebdev | last post by:
i am working on basically a proxy server that handles requests via remoting from clients and executes transactions against a third-party server via TCP. the remoting site works like a champ. my...
14
by: DaTurk | last post by:
I am makeing a Multicast server client setup and was wondering what the difference is between Socket.Connect, and Socket.Bind. It may be a stupid question, but I was just curious. Because I...
1
by: Mr. Beck | last post by:
Hello, Please Help..... I have been working with some tcp/ip socket communication within a C# program recently. Basicly, I have a program (myProblemProgram) that has a socket connected to...
4
by: Engineerik | last post by:
I am trying to create a socket server which will listen for connections from multiple clients and call subroutines in a Fortran DLL and pass the results back to the client. The asynchronous socket...
6
by: Sean | last post by:
Hi Everyone, My apologies for a somewhat dump question but I am really stuck. I have been working on this code for two days straight I am dont know what is wrong with it. when I run the code, All...
0
by: mhetfield | last post by:
Hi, I'm writing a client-server socket program. the client will be an instance of the well-known telnet application. i want to implement a simple authentication between the server and the client. ...
2
by: Jean-Paul Calderone | last post by:
On Mon, 12 May 2008 11:16:08 -0700 (PDT), petr.poupa@gmail.com wrote: I'm not sure if you need to write a server or a client. In your original code, you had a client which repeatedly established...
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
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
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
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
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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 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.