如何使用 c++ 监听网络服务器的所有 http 请求?
我对这个话题做了很多研究,但我没有找到答案,或者我找到了答案但不太理解。
我是网络/编程网络的初学者,所以我需要了解一些东西。
我的问题: 就我而言,我已经有一个 httpserver,在端口 3000 上运行。 我想要一个 C++ 程序来侦听我的网络服务器在端口 3000 上收到的所有 http 请求。
我知道我不能运行多个侦听端口 3000 的服务。所以我发现,允许的套接字客户端/服务器关系中的通信,但我认为这不太合适。我已经使用 tcpdump 扫描了来自我的端口 3000 的 http 请求,我真的很想了解如何使用 c++ 执行此操作。
我希望我已经说清楚了。
谢谢 !
I have make a lot of researches about this topic, but I don't find an answer, or I find it but don't understand really well.
I'm a beginner with network/programming network, so I need to understand something.
My question :
In my case, I have already an httpserver, running on the port 3000.
I want a c++ program who listen to all http-request that are received by my webserver on the port 3000.
I know that I can't run more than one service who listen on my port 3000. So I have discovered, socket who allow communication in relation client/server, but I don't think it's really appropriate.. Im using tcpdump to already scan http-request from my port 3000, I really would like to understand how to do this with c++.
I hope I've made myself clear.
Thank's !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
制作一个侦听端口 3000 的 C++ 程序,让服务器侦听 3001,并让您的应用程序在处理请求后将请求转发到端口 3001
make a c++ program that listens of port 3000, make the server listen on 3001 and have your app forward the requests to port 3001 after it has processed them