What is the equivlant of this:
while (Offset < packet.Data.Length)
{
Offset += m_Socket.Receive(packet.Data, Offset, packet.Data.Length - Offset, SocketFlags.None);
}
In Siliverlight? That is Windows Form and does not work with Silverlight :/ Any helped would be appreciated.
Thanks
What the function does is, on the “completed” sub, I catch 4 bytes which is a header length from my server, after I caught those 4 bytes I want to go into the endReceive method which gets the rest of the packets length.
How would I do this in Silverlight?
Silverlight does not have synchronous Socket methods. You will need to use Socket.ReceiveAsync Method.
Good example here: Pushing Data to a Silverlight Client with Sockets.
[Edit] A basic idea to do something like this: