2

I'm currently developing an application that is simillar to a simple bitmap graphics editor, like MS Paint. The application is Windows Forms and I use different c# Graphics classes for drawing.

I wonder if there is a way to use Sockets or any other tools to make my app collaborative. I want to allow several people connect to my app and draw teamwise.

Is it possible with Windows Forms? I'd appreciate any suggestions.

Gyuzal
  • 1,581
  • 10
  • 52
  • 99
  • 1
    If your question is `Is it possible with Windows Forms?` answer is **yes, definitely**. If your question is about tool to do that answer is `your question is off-topic` – Sriram Sakthivel Jan 24 '14 at 12:44
  • 1
    You might want to check out [XSockets](http://xsockets.net/api/external-api/determine-how-to-use-the-external-api): "The XWebSocket on the other hand is suited for being used in client applications such as Native Mobile Applications, WPF, **WinForms**.." – Christian Jan 24 '14 at 12:45

1 Answers1

2

At first: It doesn't matter if you use WinForms or any other template. You can easily add missing references to any type of project.

The two possible sockets would be either TCP or UDP.
A problem with these Sockets is that they are usually used for p2p connections.
Additionally only TCP guarantees the correct arrival of all sent packets, so in your case it would be highly recommended.

In this thread they discuss the problematic of many clients to one server:
TCP server with multiple Clients

If you made it to connect with multiple connections you should think of a system to handle each clients changes.
I'd propose a Server/Client system, where one person hosts the session.
Each client has a copy of the image and everytime someone changes a pixel a local event gets called that transmits the changes to the server.
The server now only has to "flush" the changes to every client connected.

One tricky thing could be two clients changing the same pixels at the same time, but thats your job =P

Community
  • 1
  • 1
mammago
  • 247
  • 2
  • 13