Solved

internet messenger

Posted on 2004-09-09
10
257 Views
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?
or
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...

thanks,
marius
0
Comment
Question by:cmaryus
10 Comments
 
LVL 8

Expert Comment

by:cooljai1
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?
0
 
LVL 3

Author Comment

by:cmaryus
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.
0
 
LVL 3

Expert Comment

by:joesinc
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:

http://www.pacificcable.com/Internet_Tutorial/Course/Section3/7.htm

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,

Joe
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 3

Accepted Solution

by:
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.
0
 
LVL 3

Author Comment

by:cmaryus
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...
0
 
LVL 3

Assisted Solution

by:joesinc
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!

0
 
LVL 3

Author Comment

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This is an article about my experiences with remote access to my clients (so that I may serve them) and eventually to my home office system via Radmin Remote Control. I have been using remote access for over 10 years and have been improving my metho…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now