Hi. I am trying to create a program to send data in real time from computer to computer. I am a bit unsure on how this will work with the server. I am thinking of serializing the objects and sending them through the server to be received by another user who is connecting to that socket.

I am not very clued up on this and need to read up more on it. The parts I am stuck with is more how the server works to receive the data and how does the other computer connect to the server to receive this data. Can this be done through any server?

Also would it be an option to write the objects info to an XML file hosted on the server and then retrieve this info from the file for the other computer?

If anyone could point me in the right direction to some information that they think could help, I would be VERY grateful!

Many Thanks

Will this server be in the same local area network as the client computer? Like, the LAN on a company or at home?

If so, one way to do this is to write a windows service on the server to "watch" a shared folder. That way you don't have to use sockets, just local access through the network.

You can then check if the file is an XML with proper namespace and format, etc.

If the server will be on the Internet, then you will have to write a Listener socket on the server using a custom port number (check that it isn't used by any other application first) and send the serialized data to the server.

There are guides on-line that will help you with serialization and de-serialization of objects.

Also if the communication is bidirectional you will also have to create the listener in the client version of the application.

For XML, the .NET framework has everything you need. Use System.Xml and you can create, read, write, whatever you need from there, it is fairly simple, but if you need help, I'm sure here on the forums you will find the info you need.

It's a general idea so you can start reading around and figuring out the best way to develop your application.

I'm sure someone here can suggest more options, I myself have little experience with the serialization and deserialization classes.

;)

A good place to start is WCF. But this might be overkill, you'll need to assess the needs of your application.

The other way would be binary serialisation and transmission. Serialise your object graph using the BinaryFormatter and you will be given a byte array containing all the data. You may send that across the wire using a socket. A good idea would be to prepend the data with an integer indicating how many bytes of data the server/client should expect.

Using the watcher is a bad idea, especially on a shared folder. The FileWatcher isn't exactly reliable in my experience and I've tried to use it and over come its short-falls, but simply put, it isn't worth it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.