473,395 Members | 2,467 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.

Can't reach my machine using TCPClient

I've got a little rudimentary client-server app. One runs a server
listening to 'any' ip on a given port and the client attempts to
connect to the external ip of my app. I am on a LAN behind a router
and, undoubtedly, a firewall.

If I make the IP I am trying to connect to 127.0.0.1 everything works
fine but as long as I am using the external IP I can't get through and
I get an exception which states that the host is actively refusing the
connection.

Is this because I am behind a router? More importantly, if this is the
case how do applications manage to get around this. For example, if I
install some new random application, it seems to have no problem
connecting to a peer-to-peer server on some random port. But my app...
gets refused.

What am I missing?

Thanks!
Aug 26 '08 #1
2 2554

"9to5" <da**********@gmail.comwrote in message
news:d2**********************************@v39g2000 pro.googlegroups.com...
>
What am I missing?

http://www.homenethelp.com/web/expla...arding-dmz.asp

If you have a personal firewall running on the computer, you would need to
set a FW rule there too, to open the required port.

Keep the machine out of the DMZ

Aug 26 '08 #2
On Mon, 25 Aug 2008 20:54:36 -0700, 9to5 <da**********@gmail.comwrote:
I've got a little rudimentary client-server app. One runs a server
listening to 'any' ip on a given port and the client attempts to
connect to the external ip of my app. I am on a LAN behind a router
and, undoubtedly, a firewall.

If I make the IP I am trying to connect to 127.0.0.1 everything works
fine but as long as I am using the external IP I can't get through and
I get an exception which states that the host is actively refusing the
connection.

Is this because I am behind a router? More importantly, if this is the
case how do applications manage to get around this. For example, if I
install some new random application, it seems to have no problem
connecting to a peer-to-peer server on some random port. But my app...
gets refused.

What am I missing?
Well, first, it's important to distinguish between what your application
is doing and what "some new random application" might be doing. In
particular, NAT routers are not always explicitly firewalls, but even when
they aren't they exhibit some firewall-like behaviors. But these
behaviors are usually disabled when a client of the NAT router _initiates_
communication outbound.

So, if this "new random application" is on your LAN but connecting to an
IP address outside the LAN, the NAT router is handling that automatically,
acting as a proxy between the client on your LAN and the outside address.
When traffic comes back inbound, it's actually addressed to the NAT
router, but the NAT router knows which client it's proxying on that
address and forwards it on automatically.

You can configure this forwarding ("port forwarding") explicitly. In
practically all cases, the NAT router will let you do this manually. For
most modern NAT routers (anything built within the last 5 years, and
including some built even earlier) they will support "Universal Plug and
Play" which is a protocol that allows clients to discover and configure
the NAT router automatically. But you would have to write your
application to support that.

There are also techniques involving "tunneling". UDP port tunneling is
particularly reliable, in spite of there being no official specification
to ensure that all NAT routers handle it, and there are techniques that
work (less often) for TCP. But it does depend on still having a known
intermediary server accessible to both clients trying to reach each other,
so if you're just trying to loop back through your Internet IP address,
that probably wouldn't be applicable.

Pete
Aug 26 '08 #3

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

Similar topics

2
by: Jim W | last post by:
This is a cross-post from the .NET group since it looks like it may not be ..NET. New information since the original post is that is the wireless network is enabled and connected the socket...
1
by: Johann Blake | last post by:
Hi, I have come across a rather bizarre problem using the TcpClient to retrieve a web page. I use the TcpClient in conjunction with a StreamWriter to write a HTTP request to the web site. The...
6
by: MajorTom | last post by:
Hello, I getting this error An established connection was aborted by the software in your host machine here: TcpClient smtpSocket = new TcpClient(_serverSmtp, _portSmtp) port = 25 (smtp...
8
by: William Meitzen | last post by:
Does someone know how I can get two projects to share a common class? Something like this: solution WholeShmeer project1 code1 CommonClass project2 code2 CommonClass
0
by: den 2005 | last post by:
Hi everybody, I am still learning how sockets, TcpClient and TcpListener work, in order that both sides to send and receive data, both sides must have a socket or TcpListener and a TcpListener...
5
by: TulasiKumar | last post by:
Hi all, I am new in Netwrok porgraming in cSharp.how can i detect Tcp/Ip packet in c#.Net.Any body knows please tell me, what are the interfaces or classes are supported regrading on TCP/IP...
7
by: Lee | last post by:
Hey all, I'm using the following code to send stuff accross the network, appologies for it being in full, but I've really no idea exactly where this error is occuring. =======network...
3
by: RFD | last post by:
I've been slaving at this problem for over a week, and would appreciate some help from you kind folks. Basic Problem: I have made a server program and a client program. When I try to use the...
0
by: sternr | last post by:
Hey, I'm using a TcpClient to create HTTP requests to my web-server (I know of HttpWebRequest, it is mandatory for me to use TcpClient.). Here's my code: TcpClient tcp = new...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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,...

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.