Click here to Skip to main content
16,007,111 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Drawing pie with parts excluded. Pin
AndrewVos14-Apr-08 20:17
AndrewVos14-Apr-08 20:17 
GeneralRe: Drawing pie with parts excluded. Pin
AndrewVos14-Apr-08 23:44
AndrewVos14-Apr-08 23:44 
GeneralRe: Drawing pie with parts excluded. Pin
#realJSOP27-Apr-08 3:34
professional#realJSOP27-Apr-08 3:34 
QuestionGridView or DetailsView results e-mailed Pin
Learning14-Apr-08 14:05
Learning14-Apr-08 14:05 
GeneralRe: GridView or DetailsView results e-mailed Pin
Christian Graus14-Apr-08 19:59
protectorChristian Graus14-Apr-08 19:59 
GeneralRe: GridView or DetailsView results e-mailed Pin
N a v a n e e t h14-Apr-08 20:30
N a v a n e e t h14-Apr-08 20:30 
GeneralRe: GridView or DetailsView results e-mailed Pin
Learning15-Apr-08 4:29
Learning15-Apr-08 4:29 
QuestionNetworkstream receiving same data twice [modified] Pin
evdsande14-Apr-08 10:05
evdsande14-Apr-08 10:05 
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:45 PM

Questionis Microsoft.ApplicationBlocks.Data.dll compatible to VS2005? Pin
Mustanseer M S13-Apr-08 21:26
Mustanseer M S13-Apr-08 21:26 
GeneralRe: is Microsoft.ApplicationBlocks.Data.dll compatible to VS2005? Pin
Dave Kreskowiak14-Apr-08 3:30
mveDave Kreskowiak14-Apr-08 3:30 
GeneralRe: is Microsoft.ApplicationBlocks.Data.dll compatible to VS2005? Pin
Christian Graus14-Apr-08 4:27
protectorChristian Graus14-Apr-08 4:27 
GeneralRe: is Microsoft.ApplicationBlocks.Data.dll compatible to VS2005? Pin
Pete O'Hanlon14-Apr-08 4:36
mvePete O'Hanlon14-Apr-08 4:36 
GeneralRe: is Microsoft.ApplicationBlocks.Data.dll compatible to VS2005? Pin
Dave Kreskowiak14-Apr-08 5:34
mveDave Kreskowiak14-Apr-08 5:34 
Questionhow can I set TextBox.ScrollBars to None or Both at call Pin
Shimmy Weitzhandler12-Apr-08 16:03
Shimmy Weitzhandler12-Apr-08 16:03 
GeneralRe: how can I set TextBox.ScrollBars to None or Both at call Pin
Shimmy Weitzhandler12-Apr-08 18:45
Shimmy Weitzhandler12-Apr-08 18:45 
QuestionIs DoDirectPayment method of PayPal applicable in Australia Pin
samrat.net10-Apr-08 23:30
samrat.net10-Apr-08 23:30 
GeneralRe: Is DoDirectPayment method of PayPal applicable in Australia Pin
Christian Graus11-Apr-08 2:13
protectorChristian Graus11-Apr-08 2:13 
Generalwhat's new in dotnet framework 2.0 architecture compared to dotnet framework 1.1 architecture Pin
padma p10-Apr-08 23:24
padma p10-Apr-08 23:24 
GeneralRe: what's new in dotnet framework 2.0 architecture compared to dotnet framework 1.1 architecture Pin
Thomas Stockwell11-Apr-08 1:21
professionalThomas Stockwell11-Apr-08 1:21 
GeneralRe: what's new in dotnet framework 2.0 architecture compared to dotnet framework 1.1 architecture Pin
Dave Kreskowiak11-Apr-08 6:58
mveDave Kreskowiak11-Apr-08 6:58 
GeneralXmlTextReader - try again Pin
coleydog10-Apr-08 19:05
coleydog10-Apr-08 19:05 
GeneralRe: XmlTextReader - try again Pin
Christian Graus10-Apr-08 20:35
protectorChristian Graus10-Apr-08 20:35 
GeneralRe: XmlTextReader - try again Pin
Mark J. Miller14-Apr-08 5:50
Mark J. Miller14-Apr-08 5:50 
GeneralRe: XmlTextReader - try again Pin
coleydog16-Apr-08 14:08
coleydog16-Apr-08 14:08 
GeneralXmlTextReader - Child elements. Pin
coleydog10-Apr-08 18:59
coleydog10-Apr-08 18:59 

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.