PDA

Click to See Complete Forum and Search --> : Sending Data Tables over TCP?


PsyMez
Dec 25th, 2009, 07:26 PM
I have started my first client server application in VB.NET i have used some code from MSDN for a basic client server application which can send a string over the stream by converting it into bytes which is then retranslated at the other side.

It seems pretty simple so far however i need to be able to send more useful objects over the stream such as data tables from my sql server... Is there a way for me to convert my data table into bytes to be reconstructed at the other side?

Thanks!

mariano_donati
Jan 15th, 2010, 08:42 AM
Yes, it's called serialization. Basically, what you do is to convert an object into an array of bytes and send over the net this array. In the other side you convert back the array into the object. It's important that both sides have the same object's data type, otherwise deserialization will fail. My approach to that is to make a dll file that has all the objects that will be sent over the network. Then in your server and client project you just need to add a reference to the dll file to make them visible.
I hope it helps!.

Regards.