开发者

Help with making a C# P2P Chat Program [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,开发者_C百科 visit the help center. Closed 9 years ago.

I want to make a P2P Chat client, all I want it to do is to be able to send text across to each peer.

I looked at a Chat Client from this example: http://www.geekpedia.com/tutorial239_Csharp-Chat-Part-1---Building-the-Chat-Client.html

And am wondering if it can be converted to a p2p program? If so how can it be and can someone provide some code as it will help a lot.

If it can't how can I make a really simple p2p chat program? Codes and examples will be very helpful.

btw I did look at this article, but it didn't help me: http://msdn.microsoft.com/en-us/library/ms751502.aspx


I did a similar project once, only using bluetooth rather than Internet.
Mine wasn't chat so much as IM, since it only allowed for two people to converse, but we got it working by using the technique in brydgesk's edit and having the client ('talker') and server ('listener') together in the same application, in such a way that the server only puts out received messages to the local client, rather than rebroadcasting to all connections.

Hope this little bit is helpful, I don't think this is really the right place to help you write the entire application.


For P2P, you need to use UdpClient instead of TcpClient. Google should help you from here :)

Edit: Sorry, I made false assumptions in this answer. If you want to continue using TCP, that's just fine. Instead of creating a separate server application, add the server code to your client application, so that either the sender or receiver acts as the server.


If it is to be done on the intranet, why not use WCF named pipes?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜