Does anyone have any advice how to write such app? Or maybe knows some nice tutorial? I would like to use System.Net.PeerToPeer namespace, but everything I can find about it is MSDN which I can't read without getting mad. Or maybe using "old-school" TCP/IP would more efficient?
I will appreciate every piece of advice. Every sample code I will shower with gold ;)
And please, don't send me back to Google for I have searched for a long time for sth useful - maybe inaccurately but time is running out and I really need some help.
[edit]
What about the Brunet library? Has anyone used it?
There is a sample at MSDN that you may find interesting: Peer Channel Chat.
Quote from the page:
The Chat sample demonstrates how to
implement a multiparty chat
application by using Peer Channel.
Messages sent by any instance of a
chat application are received by all
other instances.
The Chat sample is not based on the
concept of client and service. It is a
true peer-to-peer application with
each instance acting as a peer of
other instances. Each instance can
send messages to other instances and
receive messages from other instances
using the IChat duplex contract.
Related
I am attempting to make a chat application on the .NET framework that will be able to communicate over the internet and not just LAN. I would like it to be P2P as to not require a central server. I don't mind which protocol it uses (UDP, TCP, etc) so long as I can send messages to almost any given IP.
All I would like to know is how to send data to another IP I know of, nothing else. I've searched around but the code is too complicated for me. (For example I've looked at the source code for torrent clients).
Help will be appreciated a lot thanks.
P.S.: I've heard about a method called UDP hole-punching if that sparks any plugs.
There is a small issue with your plan.
The server-centric approach does not serve only as a slow middle man, but also as a central point with known address to connect to, an anchor in the sea to attach to and clients connect to the static IP/name of the server.
Usually, users do not care what is their IP address on the internet...
So at the minimum, the server is good to get list of clients.
Nowadays you can use some services from Microsoft or Google or other.
Now rest of the P2P communication of clients between NAT comes with more learning: TCP_hole_punching
I would suggest reading all that stuff then look for some code or library that does it.
Here is older topic similar to yours looking for the hole punching library: tcp hole punching library
I have answered similar kind of things here Peer-to-Peer application using java, let me know if it helps or if you have any specific question about this. Basically you need NAT traversal, so you would find many different ways to achieve this based on your need. Even you can achieve this simply configuring your router by enabling UPnP.
I'm a newbie C# socket programmer and I'm trying to create a C# socket chat application...
here are the requirements of the app..
*it can accept more than one client.
*it should handle those new client on a separate thread.
*the server has a list of active clients and displays them in a list(GUI)
*the server should know when a client is disconnected and will remove it from the list(probably a hashtable or array) of active clients.
honestly, I don't know where to start.
I've been reading through various articles on the net about sockets, multithreading and the likes, but I'm still a bit confused about the whole client/server interaction thing..
Any help/suggestions will be greatly appreciated.. :D
Take a look at ZeroMQ. It was designed for applications like you're describing, works very well, and is free.
I am new to C# Socket programming. I am trying to build a simplistic application that can detect when a client application connects to the server application.
When connected, I want to send 1 piece of information to the server and receive 1 response back (confirmation).
Afterwards, I just want to know when the connection is broke. Within my application, I do not have to know instantly when the connection is broken, just within the timeout if fine.
Can someone please help me understand what I need to do to accomplish this. Sample source code would be nice, again I am a novice programmer and this topic is way above my head.
I would need help with the client app and server app.
Thanks in advance!
Jorel
I would not begin with sockets if I were a novice programmer. It's not an easy subject to start with, and you need to know more than just how to send a piece of information. You need to know how the protocols work too and how do deal with their way of send/receiving information.
I would recommend you to use wcf instead, since WCF takes care of all lower level details for you. You will just need to know how to send and receive information.
Ok i got a chat client now, now i just need some tips, how you get an client implement in it, so you can so who's online on the chat fore some guys that doesnt understand me.
First, have a look in to programming sockets under C#. The IRC protocol is a simple text-based protocol that is easy to parse and respond to.
The IRC specification can be found here.
Additional specifications, here.
There are about as many ways to write a chat program as there are IRC networks! Luckily, for someone exploring socket programming, an IRC client is a great start that you can get up and running easily in a console window before you plug in a GUI.
I'm tyring to add a feature to my app that sends a nudge to all users of my program (family members inside the house), and when they receive the nudge the window of my app on their computer shakes for a second...
Can somebody please suggest how i'd have to go about this? I've never worked with tcp/ip before.. Is this what I should use, or is there something better?
I have tried to come up with my own solution however none of the samples ever work. So I thought maybe the people on SO might know of other ways?
Thank you :)
If this is just an "in-house" (pardon the pun) application, and you're all on the same network, you might consider sending a UDP broadcast packet. Each instance of your application could listen for a packet on a particular port, and when the correct one is received do the window shake thing.
You might consider UDP for this. Since you can broadcast/multicast via UDP it may be more suitable for this sort of application. There are downsides - UDP transmission is not reliable or guaranteed in the same way as TCP.
I'd go with a good XMPP Library. Maybe Jabber-Net?
You'll also have the added bonus of being able to connect to Google Chat and now Facebook chat later.
You haven't specified if presence in your case requires a server or not. If it is client/server oriented, using XMPP gives you the server side for "free" as a bonus.