English 中文(简体)
如何连接客户和服务器?
原标题:How to connect a client and a server?
  • 时间:2010-12-10 21:00:34
  •  标签:
  • c++
  • udp

Even if UDP is connection-less, I would like to establish some kind of connection between a client and a server. The thing is, once the server has received something from the client, the only thing I can do send my answer is use the IP and the Port from the client.

And well... this will, in almost EVERY CASE, not be the IP of the client, because the client doesn t have an IP on the Internet : only its router does. I would like to know how to send back data to the client, even if he s behind a router.

I m开始相信它是不可能的......但是,可以做到吗? 不要说我的视频集束只用用户向服务器发送数据。

最佳回答

仅仅通过同样的袖珍向客户寄回,国家信托局将自动解决该问题,并将它传给实际的箱子。

问题回答

Options for UDP behind firewalls:

  1. Explicit rules on the firewall/NAT forwarding UDP packets to a particular machine.
  2. UPnP to setup the rules automatically (from the client end)
  3. Automatic return path for UDP - NAT remembers ports and IP addresses, and creates a return rule for UDP packets.

你的路由人将注意到,它重新编制了一个即将卸任的数据包,以看它是否来自航线上的一个港口,并记住这一点。 如果随后向同一港口接收了UDP的包裹地址,那么我会说“Oh,我知道什么地方会把这一地址发送到网络内原始数据所得出的港口。

通常,航道者会记得一段时期的路线,如果在港口看到任何东西,就会忘记这些路线。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签