Link to home
Start Free TrialLog in
Avatar of cmaryus
cmaryus

asked on

internet messenger

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
Avatar of cooljai1
cooljai1

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?
Avatar of cmaryus

ASKER

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.
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
ASKER CERTIFIED SOLUTION
Avatar of iwontleaveyou
iwontleaveyou
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cmaryus

ASKER

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...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cmaryus

ASKER

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