Click here to Skip to main content
15,913,773 members
Home / Discussions / WPF
   

WPF

 
QuestionImage control not getting resized while resizing window Pin
DavJes18-Apr-11 0:33
DavJes18-Apr-11 0:33 
AnswerRe: Image control not getting resized while resizing window Pin
DavJes18-Apr-11 0:34
DavJes18-Apr-11 0:34 
QuestionHow to check duplicate data in listbox.itemtemplate Pin
Rocky2317-Apr-11 23:44
Rocky2317-Apr-11 23:44 
AnswerRe: How to check duplicate data in listbox.itemtemplate Pin
Abhinav S18-Apr-11 5:03
Abhinav S18-Apr-11 5:03 
GeneralRe: How to check duplicate data in listbox.itemtemplate Pin
Rocky2318-Apr-11 23:03
Rocky2318-Apr-11 23:03 
QuestionBind a UserControl string array property to containing window Pin
Jean-Louis Leroy17-Apr-11 23:08
Jean-Louis Leroy17-Apr-11 23:08 
AnswerRe: Bind a UserControl string array property to containing window Pin
Jean-Louis Leroy17-Apr-11 23:41
Jean-Louis Leroy17-Apr-11 23:41 
QuestionReceiveAsync Issues Pin
veggieCoder15-Apr-11 8:13
veggieCoder15-Apr-11 8:13 
Hello,

I'm having some difficulty retrieving JSON formatted data returned from a remote server. I'm using Silverlight 4 in VS 2010. My code is as follows:
byte[] response = new byte[32768]; 
SocketAsyncEventArgs e = new SocketAsyncEventArgs(); 
e.SetBuffer(response, 0, response.Length); 
soc.ReceiveAsync(e); 
//System.Threading.Thread.Sleep(4000); 
string data = Encoding.UTF8.GetString(e.Buffer, e.Offset, e.BytesTransferred).Trim(new char[] { '\0' });

If I uncomment the call to Sleep for 4 or 5 seconds, then my string variable "data" populates consistently. However, if I don't Sleep, then after a few times of receiving updates, the variable "data" is consistently empty (although there is data in the buffer). Basically, I have to slow the whole process down in order to get my updates. That's not an acceptable solution though, as I'm dealing with market data which needs to be processed in real-time.

Incidentally, nearly identical code works without the call to Sleep in a console app I wrote against the same remote server. In that case, the following works perfectly:
byte[] snapBytes = new byte[32768]; 
soc.Receive(snapBytes); 
String data = Encoding.ASCII.GetString(snapBytes).Trim(new char[] { '\0' });

Thanks in advance for any thoughts or ideas.
AnswerRe: ReceiveAsync Issues Pin
SledgeHammer0115-Apr-11 10:05
SledgeHammer0115-Apr-11 10:05 
QuestionPRISM in Silverlight Pin
NTheOne15-Apr-11 0:30
NTheOne15-Apr-11 0:30 
AnswerRe: PRISM in Silverlight Pin
Tarun.K.S15-Apr-11 0:59
Tarun.K.S15-Apr-11 0:59 
AnswerRe: PRISM in Silverlight Pin
Pete O'Hanlon15-Apr-11 1:59
mvePete O'Hanlon15-Apr-11 1:59 
AnswerRe: PRISM in Silverlight Pin
Abhinav S15-Apr-11 17:58
Abhinav S15-Apr-11 17:58 
QuestionWPF PopUp control Pin
Rahul Chitte14-Apr-11 1:59
Rahul Chitte14-Apr-11 1:59 
AnswerRe: WPF PopUp control Pin
Pete O'Hanlon14-Apr-11 2:20
mvePete O'Hanlon14-Apr-11 2:20 
AnswerRe: WPF PopUp control Pin
Ian Shlasko14-Apr-11 3:19
Ian Shlasko14-Apr-11 3:19 
AnswerRe: WPF PopUp control Pin
Abhinav S14-Apr-11 3:32
Abhinav S14-Apr-11 3:32 
GeneralRe: WPF PopUp control Pin
Tarun.K.S14-Apr-11 3:50
Tarun.K.S14-Apr-11 3:50 
GeneralRe: WPF PopUp control Pin
Abhinav S14-Apr-11 4:05
Abhinav S14-Apr-11 4:05 
QuestionAnother Dummies question (sorry) Pin
Johnny J.14-Apr-11 0:53
professionalJohnny J.14-Apr-11 0:53 
AnswerRe: Another Dummies question (sorry) Pin
Pete O'Hanlon14-Apr-11 1:33
mvePete O'Hanlon14-Apr-11 1:33 
GeneralRe: Another Dummies question (sorry) Pin
Johnny J.14-Apr-11 2:26
professionalJohnny J.14-Apr-11 2:26 
GeneralRe: Another Dummies question (sorry) Pin
Pete O'Hanlon14-Apr-11 2:52
mvePete O'Hanlon14-Apr-11 2:52 
GeneralRe: Another Dummies question (sorry) Pin
Johnny J.14-Apr-11 2:55
professionalJohnny J.14-Apr-11 2:55 
GeneralRe: Another Dummies question (sorry) Pin
Pete O'Hanlon14-Apr-11 3:19
mvePete O'Hanlon14-Apr-11 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.