如何通过互联网制作聊天应用 [英] How do I make a chat app over internet

查看:131
本文介绍了如何通过互联网制作聊天应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在两个应用程序(使用c ++ builder)之间存在连接问题,这些应用程序在本地网络中运行良好,但在Internet上无法正常工作,因为客户端和服务器都在不同的路由器中,每个人都有一个内部&外部知识产权,我想你了解我。



所以,我在论坛搜索,我找到了两个解决方案:

1 - NAT:我想你知道,它没有帮助我,我遇到了两个问题:

N°1:就是你在网吧里吃午餐时,例如,你无法访问调制解调器以设置NAT。

N°2:我不确定,但我读到如果客户端和服务器都使用的话它不起作用NAT。

2 - 一个网络服务器,谁在两个应用程序之间建立关系,没有NAT设置。:-(但它需要一个网站,我有尝试使用 http://WWW.Hostinger.com 上的免费网站,我写了一个PHP代码,但没有结果,我失败。



任何人都可以帮助我,告诉我失败的地方,或者给我另一个解决方案。

& thanks。

解决方案

看起来你已经理解了p roblem很好。你正在使用上面的第2步 - 这对于TCP来说基本上是STUN。我强烈建议使用UDP over TCP进行聊天服务。



阅读UDP打孔和STUN。



http://en.wikipedia.org/wiki/UDP_hole_punching [ ^ ]



http://en.wikipedia.org/wiki/STUN [ ^ ]


谢谢 bling ,但是这种方法,没有路由器配置就可以了?

mmm,你能给我一个更好理解的源代码吗? ;)

I have a problem of connection between two application ( with c++ builder ), the apps are working good in a local network, but aren't work in the internet, `cause both of the client and the server are in deferent routers, and each one have an internal & external IP, I think u understood me.

So, I searched in forums and I found two solution:
1 - NAT: I think you know it, it didn't help me, I got two problems:
N°1: is when you lunch your app in a cyber cafe for example, you can`t access to the modem to setup the NAT.
N°2: i`m not sure but I read that it doesn't work if the both of the client and the server are using the NAT.
2 - A web server, that who makes the relation between the two apps, without a NAT setup.:-( but it need a web site, I have try it with a free web site from http://WWW.Hostinger.com , and i wrote a php code, but without result, I failed.

Can any one help me please, show me where I failed, or give me an other solution.
& thanks.

解决方案

It looks like you already understand the problem quite well. You're on the right track with your step 2 above - which is basically STUN for TCP. I strongly suggest using UDP over TCP for a chat service.

Read up on UDP Hole Punching and STUN.

http://en.wikipedia.org/wiki/UDP_hole_punching[^]

http://en.wikipedia.org/wiki/STUN[^]


Thanks bling, but this method, is it work without router configuration?
mmm, can u give me a source code for Better understanding. ;)


这篇关于如何通过互联网制作聊天应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆