路由器后面的服务器程序

编程入门 行业动态 更新时间:2024-10-21 11:59:28
本文介绍了路由器后面的服务器程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在这里了解很多事情.我不想通读完整的书卷或文章,只是想解决下面提到的情况.另外,我在所见过的论坛中找不到答案.如果可以的话,请直接给我一个简洁的答案.这个问题(我希望)与我使用的编程语言无关.如果这很重要,可以将Visual C ++视为我正在使用的语言.所以这是我的问题.请忍受. 我使用的网络是通过代理连接到Internet的.我使用 www.whatismyip/ [ ^ _ ^ ].它显示了我的外部IP以及检测到的代理名称.外部IP似乎从未改变. 我可以制作一个托管在本地计算机和服务器上的服务器程序.可以接受连接&使用相应的客户端程序在局域网内的其他本地计算机之间进行数据传输.由于LAN的IP是由DHCP服务器分配的,因此重新启动时,所有本地计算机最终都将具有不同的IP.为了使事情变得容易,服务器程序在特定的计算机上运行.侦听特定的硬编码端口.客户端程序具有硬编码到其中的该服务器计算机的计算机名.它们从计算机名&解析服务器的IP.连接到特定的硬编码端口.我猜客户端的端口是由客户端计算机中的操作系统分配的.每当我启动服务器程序和本地服务器时,本地计算机中的防火墙都会请求许可.我总是允许它访问所有公共网络.防火墙从不向我的客户端程序请求权限.他们工作正常.在这种情况下,通过服务器程序,我的意思是可以监听端口并接受传入的连接"&通过客户端程序,我的意思是它试图连接到特定已知计算机上的服务器程序". 到目前为止,我只需要处理一个IP地址和一个IP地址即可.服务器的单个端口(从编程的角度来看).从连接的角度来看,我有两个IP及其两个对应的端口. 我打算制作一个服务器程序,该程序可以接受来自本地LAN外部的连接(最好是TCP).我无法访问路由器.我打算在这里将服务器程序托管在本地计算机中.我想让服务器程序在本地客户端和外部客户端(与我的客户端没有相同外部IP的客户端)之间进行数据传输.外部客户端本身可能具有一个外部IP和一个内部IP. 这可能吗?如何做呢?函数调用的外观如何?请提供一个代码段(如果可能的话). 我在这里的本地计算机中使用了"Ares Galaxy p2p"之类的程序,发现它们可以正常运行.即使他们使用连接管理器执行此操作(我感觉是这样),最终他们仍然能够将LAN外部的远程计算机与本地计算机连接.据我所知,连接管理器程序仅用于获取它尝试连接的Computer1和Computer2的IP地址集.一旦Computer1和Computer2上的程序具有彼此的信息,它们就可以直接连接(在那一刻,一个充当服务器,另一个充当客户端). 就我而言,我声称拥有的信息集是 internal&我的本地计算机的外部IP (具有服务器程序),内部& 尝试连接的外部客户端的外部IP地址和我可以为服务器程序设置的任意端口地址. 由于无法访问路由器,因此有关端口转发"的文章没有帮助.我想通过外部检查(例如从一个网站)来了解局域网外部可用的端口是什么,但是到目前为止,我使用过的所有网站都表明我的端口都已关闭;这些端口必须是代理服务器的端口).无论如何,战神程序正在执行数据传输. 请给我具体的问题答案.我希望这个问题能得到很好的解释(并且可以避免许多常见的背景信息搜寻问题:)).如果上述内容在上下文中似乎不正确,请更正我.我不确定的许多内容都以陈述的形式表达.谢谢.

There are a lot of things I''m trying to understand here. I don''t want to read through entire book volumes or articles, just the possible solution to the condition mentioned below. Also, I couldn''t find the answer in the forums I have seen. Please direct to me a concise answer if available. The question (I hope) is not dependent on the programming language I am using. Visual C++ can be considered as the language I am using if that is important. So here is my question. Please bear with the length. I use a network in which I am connected to internet through a proxy. This information was confirmed by me using www.whatismyip/[^_^]. It showed my external IP and the name of the proxy detected. The external IP never seem to change. I could make a server program which is hosted in a local computer & could accept connections & do data transfer between other local computers within the LAN using corresponding client program. Since, the IPs of the LAN are assigned by a DHCP server, all the local computers end up having different IPs whenever rebooted. To makes things easier, the server program runs on a particular computer & listens to a particular hard-coded port. The client programs have the computer name of that server computer hard-coded into them. They resolve the IP of the server from the computer name & connect to the particular hard-coded port. I guess the port of the client is assigned by the OS in the client computer. The firewall in the local computer asks permission whenever I start the server program & I always allow it to access all public networks. Firewall never asks permission for my client programs & they work alright. In this context, by server program I mean which can "listen to a port and accept incoming connections" & by client program I mean "which tries to connect to a server program at a particular known computer". So far I had to deal with a single IP address & a single port that of the server (from programming point of view). From the connection point of view, I had two IPs and their two corresponding ports. I intend to make a server program that can accept connections (preferably TCP) from outside my local LAN. I have no access to the router. I intend to host the server program in a local computer here. I would like to have the server program do data transfer between a local client and an external client (a client who doesn''t have the same external IP as mine). The external client himself might have an external IP and an internal IP. Is this possible? How can it be done? How would the function calls look like? Please provide a code snippet (if possible). I have used programs like "Ares Galaxy p2p" in the local computers here and seen that they work alright. Even though they do it using a connection manager (I feel so), ultimately they are capable of connecting a remote computer outside my LAN with my local computer. As far as I know, the connection manager program is used only to procure the set of IP addresses of the Computer1 and Computer2 that it is trying to connect. Once the programs at Computer1 and Computer2 has information about each other, they can connect directly (one acting as a server & another as a client for that moment). In my case, the set of information I claim to have are internal & external IPs of my local computer (which has the server program), internal & external IPs of the client outside who is trying to connect and an arbitrary port address that I can set for the server program. Articles on "port-forwarding" have not been helpful since I have no access to the router. I would like to know what are the usable ports from outside my LAN through an external checking (like from a website; but so far all the websites I have used show that my ports are all closed; those must be the ports of the proxy sever). Anyways, Ares program is doing the data transfer. Please give me specific answers to the questions. I hope the problem is well explained (& so many usual background-information-seeking-questions can be avoided :) ). Please correct me if anything stated above seems incorrect to the context.Many of the things which I''m unsure are expressed as statements. Thank You.

推荐答案

此处 [ ^ ]是描述Skype和其他人如何绕过防火墙的文章.使用这些技术应该可以避免您无法访问路由器. 这不太可能是完整的解决方案,但运气好的话,它会带您正确的方向. 可能值得研究的另一件事是ftp 被动模式的工作方式. Wikipedia可能是一个不错的起点. 干杯, 彼得 Here[^] is an article that describes how Skype and others get around firewalls. Using those techniques should get around your lack of access to the router. This is unlikely to be the complete solution, but with any luck it will get you started in the right direction. Another thing that might be worth studying is how ftp passive mode works. Wikipedia is probably a good place to start. Cheers, Peter

更多推荐

路由器后面的服务器程序

本文发布于:2023-10-12 17:08:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1485342.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路由器   服务器   程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!