internet messenger

Posted on 2004-09-09
Last Modified: 2013-11-21
i'm trying to build a small messenger application, peer-to-peer, very simple, using window sockets.
the thing is that is working when i'm using a real ip.
but when i test it from a lan, i cannot connect to the other peer if i'm passing through a proxy.

is there a posibility to program the application to work through a proxy?
if i'm in a lan, and i have a c application which start a listening server on any port (3333 for example), can i access this port from outside?

sorry if my questions seem stupid, but i don't know so much about networks...

so i would appreciate any suggestion, explication, etc...

Question by:cmaryus

Expert Comment

ID: 12017146
It could be that you are connected through a proxy or a firewall which is blocking the port 3333. In that case you will have to open the particular port. Please give more info on the type of network you are in and what is the proxy/firewall that is being used there?

Author Comment

ID: 12017181
first, i don't know much about the proxy/firewall used on my network (i'm accesing the internet from office).
what i want is to design a solution that could work through a proxy, not necessarily the case i described above.

Expert Comment

ID: 12018559
To start with, heres an example scenario of an established chat session when your program is working in the future:

Incoming packets destined for your chat program will come from the Internet and hit a firewall. If port 3333 is opened up on the firewall then it will pass them through and it will consult its rule table to identify the appropriate machine to forward the packets on to. If port 3333 is closed on the firewall, then the story ends here. You need to make sure the port is open for this to work.

It will forward them to the proxy server which will consult its list of exisiting connections and it will see from the source IP that the chat packet is part of a session destined for your workstation, and forward the packet on to you. Your workstation will recieve the packet and the from IP will read as the external IP of your chat-mates' network (or his direct IP if he is on a modem to the Internet).

That scenario is the most normal one.

You need your software (I'm no programmer so I'll generalise) to be aware of proxies. In Internet Explorer, Firefox, RealPlayer and any other proxy-aware program that exists, you have to tell the program the address of the proxy server. So I'm guessing that when the program knows it is using a proxy, it send the packets out specially formatted, or instructs the appropriate part of the operating system that creates packets on its behalf to do so - to be honest I don't know how packets get made* I just make servers work!

*A mummy packet and a daddy packet have a 'special hug' and then 9 processor cycles later a little baby packet is made?

In the most basic terms, an IP packet consists of a packet header and the data it is carrying. The header holds the destination IP and the source IP.

Theres more to it than that, for example the header contains information about which packet this one is in the sequence and all sorts of other cool stuff. You might find these pages helpful:

But that page looks mighty dull, I'd suggest lookign for packet structure info on the Internet.

For your chat packets inside a network with a proxy, the Proxy server would be the destination IP because they have to go there first, and your workstation would be the source IP, so there must be some clever way of letting the proxy know the 'real' destination IP which is the IP of your Chat-mate on the other side of the Internet. It must be hidden in the packet header because the proxy doesn't care about the data segment, and wont look in there. It is merely a middle man.

I'm guessing there will be programming resources out there (or the programing sections of EE I suppose) where you can find out about how to control the structure of a packet, or steal some code where someone has already done it.

I hope that helps,

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.


Accepted Solution

iwontleaveyou earned 125 total points
ID: 12024115
MOst of the Proxy/Firewalls Uses PAT or NAT technique.

You can programm ur application to work with port 80 and 1080 bcoz mostly Proxy/firewalls are used for internet sharing which works with port 80 and some times they are used to allow traffic from socks port 1080.

so try it It may help you .

we can only give you an idea bcoz we are network engineers not the programmers.

It will be good if you post a copy of this question in programming section. Might be you get some help from there.

Author Comment

ID: 12024148
thank you so much for the explanation.
i will try to put a link to this question on the programming section.

i won't close the question yet, because i might come back with another questions.

for now:
joesinc: i get it: in order to acces an external ip, i have to go through proxy. i will use a sniffer to see how does my browser connects through the proxy...

joesinc, iwontleaveyou: if i would start a listening server on port 80, is it possible that an external ip could access my server, through proxy of course...

Assisted Solution

joesinc earned 125 total points
ID: 12024887
Right, if you want people to send requests to your internal machine on port 80, then you need your firewall to know what incoming requests on port 80 are permitted and also it must know where to send those packets on to.

So if you get can get your hands on the firewall configuration you could program it up to forward port 80 packets. But a lot of corporate environments already have port 80 in use for a website they serve. But that doesn't matter cos there are lots of ports to go around and you can switch back to 3333 or whatever you like.

My explanation earlier was a bit wrong actually. Outgoing packets from your client go via the proxy and then on to the firewall and out to the Internet as I said, but the responses come back to the firewall and the firewall would be configured to route packets directly to your PC. They COULD be routed back in via the proxy but MS Proxy server and ISA server don't have the capacity to re-route packets on to teh correct PC (at least I've not done that before) so you might as well just tell the firewall to route packets to your PC.

Of course you are then exposing port 3333 on your PC to the Internet, so you need to make sure your software doesn't have any dodgy unchecked buffers etc!


Author Comment

ID: 12641909
i agree about spliting the points. sorry, but i haven't got time to work on this part...

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IPv6 and IPv4 Subnetting scheme 4 48
Cisco WRVS4400N 11 38
Connection Dropouts to Database on Windows Server 2008 R2 DFS 12 23
Home firewall recommendations 11 58
If your business is like most, chances are you still need to maintain a fax infrastructure for your staff. It’s hard to believe that a communication technology that was thriving in the mid-80s could still be an essential part of your team’s modern I…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question