开发者

Multiplayer game

开发者 https://www.devze.com 2022-12-25 13:59 出处:网络
Using either XNA OR just the usual c# win forms application, w开发者_运维技巧hich would be the best way to create the feature that enables text messages to be sent from me to my friend over the intern

Using either XNA OR just the usual c# win forms application, w开发者_运维技巧hich would be the best way to create the feature that enables text messages to be sent from me to my friend over the internet?

I don't know if this matters or not, but I now have 3 Mobile Broadband internet... so it's like... Wireless internet, does that matter?


It is quite difficult to "reach your friend over the internet", whatever the framework.

Reaching someone's PC requires knowing the IP address of the destination PC. If the PC is behind a router, the PC most likely has a private IP address, thus is unreachable unless the router implements some form of forwarding (in which case a given TCP port is forwarded to a given PC's internal IP address). Then, you need to configure the router to use DDNS so that your code can get at the router's IP address.

So, it is possible (using the classes mentioned by @Bob), but not for the faint of heart.

The way professional programs (like chat clients) do it is to have a central server that relays messages. The code running on your PC and on your friend's PC sends messages to this server instead of directly to each other, so one doesn't need to know the IP address of the other one. But going this route requires some form of hosting for the server PC.


You could look into the Socket class or the simpler TcpClient and TcpListener. Whether XNA or Winforms shouldn't matter. Using XNA on the Windows platform gives you access to the entirety of the .NET framework, including the networking aspects.


I agree with Timores, you can't directly reach the device of your friend and you will need a server for that. Sockets are not something operators allow when you are connected using 3G and not WIFI.
You are welcome to try if you like the Skiller SDK solution: www.skiller-games.com (full disclosure: I am from Skiller), we have distributed servers so you don't need to host anything and besides other tools you can use the built in social layer where your users will be able to make a list of friends and send messages to each other.
Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号