Click here to Skip to main content
15,902,777 members
Home / Discussions / Mobile
   

Mobile

 
QuestionHow to stream an FLV video on a device application Pin
Vivek Vijayan7-Sep-09 5:55
Vivek Vijayan7-Sep-09 5:55 
QuestionMobile Application Pin
Learpheal3-Sep-09 16:15
Learpheal3-Sep-09 16:15 
AnswerRe: Mobile Application Pin
PavanPareta3-Sep-09 20:54
PavanPareta3-Sep-09 20:54 
QuestionDigital Citation For Windows Mobile Pin
lancerta3-Sep-09 11:22
lancerta3-Sep-09 11:22 
AnswerRe: Digital Citation For Windows Mobile Pin
jzonthemtn23-Sep-09 3:43
jzonthemtn23-Sep-09 3:43 
QuestionCannot call Camera function [modified] Pin
ahzarmokhli2-Sep-09 19:33
ahzarmokhli2-Sep-09 19:33 
AnswerRe: Cannot call Camera function Pin
Joel Ivory Johnson7-Sep-09 3:01
professionalJoel Ivory Johnson7-Sep-09 3:01 
QuestionIs this a Bug in Compact Framework 2.0 ? (C#, DateTime + TimeSpan) [modified] Pin
KingLooie2-Sep-09 1:39
KingLooie2-Sep-09 1:39 
Hello all,

this is my first post in this forum, hopefully I am not breaking too many rules at once.

I am writing a mobile application using Visual Studio 2005. When the mobile device needs
to synchronize with a server, I turn on the wireless hardware and then try "pinging" the
server to make sure it is available.

I want the device to try for 30 seconds and then abort with an error message.

This is code I wrote for that (myPing() just sends the string "PING" to the server and the
server is supposed to say "OK" or something like that) :

DateTime endTime = DateTime.Now + new TimeSpan(0, 0, 30);
bool serverFound = false;
while (DateTime.Now < endTime && !serverFound)
{
     System.Threading.Thread.Sleep(100);
     serverFound = Client.myPing();
}


Strangly, sometimes (but not always !) the loop keeps executing forever. I inserted logging statements to verify that the loop keeps executing (doesnt hang). It's just the condition is never false.

I fixed the code by using this instead :

int endTime = System.Environment.TickCount + (30 * 1000);
bool serverFound = false;
while (System.Environment.TickCount < endTime && !serverFound)
{
     System.Threading.Thread.Sleep(100);
     serverFound = Client.myPing();
}


Which works fine. Now I would just like to ask: is this a bug in the compact framework ?
Did I do anything wrong ?

Love to hear your comments. Thanks for reading.

modified on Wednesday, September 2, 2009 7:55 AM

AnswerRe: Is this a Bug in Compact Framework 2.0 ? (C#, DateTime + TimeSpan) Pin
fergara2-Sep-09 2:22
fergara2-Sep-09 2:22 
GeneralRe: Is this a Bug in Compact Framework 2.0 ? (C#, DateTime + TimeSpan) Pin
KingLooie2-Sep-09 2:39
KingLooie2-Sep-09 2:39 
QuestionRunning Blackberry Application........Problem Pin
shaina223131-Aug-09 21:44
shaina223131-Aug-09 21:44 
QuestionIni file handling Pin
Sunshine Always28-Aug-09 2:38
Sunshine Always28-Aug-09 2:38 
AnswerRe: Ini file handling Pin
slumberparty7-Sep-09 20:25
slumberparty7-Sep-09 20:25 
GeneralRe: Ini file handling Pin
Sunshine Always21-Sep-09 0:53
Sunshine Always21-Sep-09 0:53 
QuestionHow to get the IMEI number of pocket PC windows Mobile Phone using VC++ Pin
programmer8127-Aug-09 19:16
programmer8127-Aug-09 19:16 
AnswerRe: How to get the IMEI number of pocket PC windows Mobile Phone using VC++ Pin
Mr. Prakash12-Sep-09 23:50
Mr. Prakash12-Sep-09 23:50 
GeneralRe: How to get the IMEI number of pocket PC windows Mobile Phone using VC++ Pin
programmer8113-Sep-09 15:59
programmer8113-Sep-09 15:59 
AnswerRe: How to get the IMEI number of pocket PC windows Mobile Phone using VC++ Pin
LHP02103-Nov-09 21:22
LHP02103-Nov-09 21:22 
QuestionTurn my PDA to USB Mass Storage Pin
dagwaping200027-Aug-09 7:34
dagwaping200027-Aug-09 7:34 
AnswerRe: Turn my PDA to USB Mass Storage Pin
Joel Ivory Johnson7-Sep-09 3:00
professionalJoel Ivory Johnson7-Sep-09 3:00 
QuestionSHDeviceLockAndPrompt problems Pin
Paulo Mitchell27-Aug-09 5:00
Paulo Mitchell27-Aug-09 5:00 
QuestionActiveSync: How to detect synchronization in progress? Pin
Vautour25-Aug-09 22:47
Vautour25-Aug-09 22:47 
QuestionMessge "the device is not ready" occur. Pin
Le@rner20-Aug-09 20:42
Le@rner20-Aug-09 20:42 
AnswerRe: Messge "the device is not ready" occur. Pin
João Paulo Figueira25-Aug-09 22:09
professionalJoão Paulo Figueira25-Aug-09 22:09 
GeneralRe: Messge "the device is not ready" occur. Pin
Le@rner25-Aug-09 22:15
Le@rner25-Aug-09 22:15 

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.