Click here to Skip to main content
15,892,575 members
Home / Discussions / Mobile
   

Mobile

 
GeneralRe: Launch/Call an Application/Function on the keypress and hold event Pin
Ravenet21-Apr-08 2:28
Ravenet21-Apr-08 2:28 
GeneralRe: Launch/Call an Application/Function on the keypress and hold event Pin
Parasmani Swamy28-Apr-08 23:24
Parasmani Swamy28-Apr-08 23:24 
GeneralConsuming web service from mobile app Pin
CodingYoshi16-Apr-08 9:12
CodingYoshi16-Apr-08 9:12 
GeneralRe: Consuming web service from mobile app Pin
Ravenet16-Apr-08 15:57
Ravenet16-Apr-08 15:57 
Questionproblem in windows os function calls while plug out the storage card [modified] Pin
anish.chandran16-Apr-08 6:22
anish.chandran16-Apr-08 6:22 
QuestionWhy do IWebBrowser2::Navigate2 return E_FAIL? Pin
Johann Gerell14-Apr-08 23:48
Johann Gerell14-Apr-08 23:48 
QuestionHow to make a floating window Pin
Qilinzhi14-Apr-08 22:27
Qilinzhi14-Apr-08 22:27 
GeneralNetworkstream receiving same data twice [modified] Pin
evdsande14-Apr-08 10:29
evdsande14-Apr-08 10:29 
Hi,

I'm writing a program on the .NET compact framework to connect to the MPD musicplayer via a wifi connection. When I run the program from the simulator it runs fine. However when I deploy the software on the real device, I see the strange fenomenom, that I get the same data back from the the Networkstream object twice (even when connected through the active sync app). I checked the network traffic and I can see no errors there, the messages are correctly in sync. The stream.read method however returns the same data twice, when I do a re-read the correct message is received and the software runs smoothly furtheron. I disabled the optimizer, played around with the socket options, without any result. Adding delays between send and receive doesn't help either, however I do see a difference in debug and release versions. Stepping through the code does not show the problem anymore.

// The code i use to send and receive
protected void sendCommand(string command)
{
if (stream != null)
{
mLock.WaitOne();
OnLog(">>" + command + "\r\n");
byte[] sendBytes = System.Text.Encoding.ASCII.GetBytes(command + "\r\n");
connection.GetStream().Write(sendBytes, 0, sendBytes.Length);
}
}

protected string readResponse(bool check)
{
if (stream != null)
{
byte[] myReadBuffer = new byte[connection.ReceiveBufferSize];
NetworkStream myStream = connection.GetStream();
StringBuilder response = new StringBuilder();
int numberOfBytesRead = 0;
if (stream.CanRead)
{
do
{
numberOfBytesRead = myStream.Read(myReadBuffer, 0, myReadBuffer.Length);
response.Append(Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead));
commander.addDatatrafic(numberOfBytesRead);
}
while (myStream.DataAvailable && numberOfBytesRead > 0);
OnLog("<<" + Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead) + "\r\n");
response.Replace("\n", "\r\n");
if (check)
{
if (!checkOK(response.ToString()) && !checkFailed(response.ToString()))
{
response.Append(readResponse());
}
}
mLock.ReleaseMutex();
//lastresponse = response.ToString();
return response.ToString();
}
return "";
}
else
{
return "";
}
}


Anybody any ideas?

Regrards,

eric

modified on Monday, April 14, 2008 4:43 PM

AnswerRe: Networkstream receiving same data twice Pin
Arjun Marwaha24-Apr-08 2:29
Arjun Marwaha24-Apr-08 2:29 
QuestionHow to catch usb event Pin
haolan13-Apr-08 22:04
haolan13-Apr-08 22:04 
AnswerRe: How to catch usb event Pin
Ravenet16-Apr-08 16:01
Ravenet16-Apr-08 16:01 
GeneralRe: How to catch usb event Pin
haolan21-Apr-08 1:31
haolan21-Apr-08 1:31 
GeneralRe: How to catch usb event Pin
Ravenet21-Apr-08 2:03
Ravenet21-Apr-08 2:03 
GeneralRe: How to catch usb event Pin
haolan21-Apr-08 2:11
haolan21-Apr-08 2:11 
GeneralRe: How to catch usb event Pin
Ravenet21-Apr-08 2:16
Ravenet21-Apr-08 2:16 
QuestionHow can I monitoring dial and how to Disconnect for POCKET PC Pin
smsm365011-Apr-08 3:36
smsm365011-Apr-08 3:36 
QuestionHow to launch pword.exe in .NET 2005 'Smart Device project' Pin
tony_Udz11-Apr-08 0:14
tony_Udz11-Apr-08 0:14 
GeneralRe: How to launch pword.exe in .NET 2005 'Smart Device project' Pin
Arjun Marwaha15-Apr-08 21:32
Arjun Marwaha15-Apr-08 21:32 
QuestionHow to Program with Wireless Sensors Pin
csnovice9-Apr-08 18:40
csnovice9-Apr-08 18:40 
QuestionIs my C.F. 2.0 crazy?.....Or not? Pin
Hurricane30009-Apr-08 10:47
Hurricane30009-Apr-08 10:47 
AnswerRe: Is my C.F. 2.0 crazy?.....Or not? Pin
Mitch F.9-Apr-08 19:35
Mitch F.9-Apr-08 19:35 
GeneralRe: Is my C.F. 2.0 crazy?.....Or not? [modified] Pin
Hurricane300010-Apr-08 3:56
Hurricane300010-Apr-08 3:56 
GeneralRe:Resolved! [modified] Pin
Hurricane300010-Apr-08 6:34
Hurricane300010-Apr-08 6:34 
Questionhow can i get x,y from GPS using PPC in C# code ? Pin
E_Gold9-Apr-08 9:29
E_Gold9-Apr-08 9:29 
AnswerRe: how can i get x,y from GPS using PPC in C# code ? Pin
Ed.Poore12-Apr-08 12:26
Ed.Poore12-Apr-08 12:26 

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.