Hi,
I have some experience in using TCP sockets in Silverlight. First you have to create a DnsEndPoint and the Socket. Then you connect and start receiving data.
For example:
DnsEndPoint endPoint = new DnsEndPoint( Application.Current.Host.Source.DnsSafeHost, 4531 );
Socket socket = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
SocketAsyncEventArgs args = new SocketAsyncEventArgs();
args.UserToken = socket;
args.RemoteEndPoint = endPoint;
args.Completed += new EventHandler<SocketAsyncEventArgs>( OnSocketConnected );
socket.ConnectAsync( args );
In OnSocketConnected I receive a SocketAsyncEventArgs and attach to the Completed event.
byte[] response = new byte[bufferSize];
e.SetBuffer( response, 0, response.Length );
e.Completed -= new EventHandler<SocketAsyncEventArgs>( OnSocketConnected );
e.Completed += new EventHandler<SocketAsyncEventArgs>( OnSocketReceive );
Socket socket = ( Socket )e.UserToken;
socket.ReceiveAsync( e );
Well now in OnSocketReceive I also receive the SocketAsyncEventArgs parameter. And I also did have some problems when reading but I found out that the SocketAsyncEventArgs e parameter has a property called BytesTransffered. When reading the received data from e.Buffer[] you should read from 0 to e.BytesTransffered but not the entire array.
I'm not sure if this is your case, maybe you could give some more information.
Hope this helps.