473,714 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(IPA ddress.Parse("1 27.0.0.1"),
_settings.Clien tPort)
Try
sender.Start()
sender.BeginAcc eptSocket(Addre ssOf SenderBeginAcce ptEventHandler, sender)
Catch ex As SocketException
MessageBox.Show ("Unable to accept connections on port " &
_settings.Clien tPort & ".", "Web Proxy", MessageBoxButto ns.OK,
MessageBoxIcon. Exclamation)
End Try
Mar 28 '07 #1
3 1957

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

Dim sender As TcpListener = New TcpListener(IPA ddress.Parse("1 27.0.0.1"),
_settings.Clien tPort)
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(IPA ddress.Any, _settings.Clien tPort);

Regards,
Goram
Mar 28 '07 #2
Hello,

you are binding to the localhost address.

Try

Dim sender As TcpListener = New TcpListener(IPA ddress.Any,
_settings.Clien tPort)

Best regards,
Henning Krause
"Wayne And Miles" <do********@now here.comwrote in message
news:46******** **************@ news.optusnet.c om.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(IPA ddress.Parse("1 27.0.0.1"),
_settings.Clien tPort)
Try
sender.Start()
sender.BeginAcc eptSocket(Addre ssOf SenderBeginAcce ptEventHandler, sender)
Catch ex As SocketException
MessageBox.Show ("Unable to accept connections on port " &
_settings.Clien tPort & ".", "Web Proxy", MessageBoxButto ns.OK,
MessageBoxIcon. Exclamation)
End Try

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

you are binding to the localhost address.

Try

Dim sender As TcpListener = New TcpListener(IPA ddress.Any,
_settings.Clien tPort)

Best regards,
Henning Krause
"Wayne And Miles" <do********@now here.comwrote in message
news:46******** **************@ news.optusnet.c om.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(IPA ddress.Parse("1 27.0.0.1"),
_settings.Clie ntPort)
Try
sender.Start ()
sender.BeginAc ceptSocket(Addr essOf SenderBeginAcce ptEventHandler, sender)
Catch ex As SocketException
MessageBox.Sho w("Unable to accept connections on port " &
_settings.Clie ntPort & ".", "Web Proxy", MessageBoxButto ns.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
8521
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 my server program written in python it simply hangs.it does not show any error also.I've tried sample programs available .I don understand what the reason is as i am quite new to it. here is teh server side program: ///////////////////////
5
3681
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 but have been unsuccessful in finding the answers so far. Either because my understanding of sockets isn't where it needs to be or my questions are too basic. My programming environment is Windows XP, Visual Studio .NET 2003 and C#. So here it...
13
2640
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 problem is executing the transactions against the remote server and returning the response to the remoting client. i can open the socket fine and, if i am executing one transaction at a time, everything works great. it's when my proxy server...
14
25266
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 tried a test, and I can't bind two sockets to the same port/ip but I can connect with one socket, and bind with another to the same ip/port. Thanks
1
17548
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 another program for information passing. Upon receiving a particular "command" from the the information passing program, myProblemProgram will launch a separate thread to do individual communication with another file transfer program. The thread...
4
3604
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 client and asynchronous socket server example code provided in the .NET framework developers guide is a great start but I have not dealt with sockets before and I am struggling with something. From what I can tell the sample server code ...
6
2848
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 I get is Input: and the program quits. I also tried reading this online but I didn't quite get it. What is the diff between sin_addr and sin_addr.s_addr. My understanding is that the latter is the IP address of my machine where as the former is...
0
1828
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. - the client should send this message (after the connection established): my password "anypassword" and the server will check, if it's not the same password that's hardcoded in the server program, the server close connection. so the client will...
2
227
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 out- bound connections. Here, you say you need to listen on a port. The basic version is pretty easy either way. However, with Twisted, you get cross-platform error handling without any extra effort, and you don't have to think about the...
0
8701
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9168
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9068
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7942
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6621
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5943
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3155
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 we have to send another system
2
2510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2103
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.