.NETGURU
blocking function call
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-io' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

dave wanta (VIP)
hi all,
I have a code snippet that I don't know how to handle, and am looking for direction, examples, etc....

I have some code that could hang indefinitely, and what I need to do is stop the code from executing if it doesn't execute within n milliseconds.

here is an example.

//build and construct a socket...
// socket code here....
// everything works great..
// but if the socket doesn't get a response back, everything hangs....

socket.ReceiveFrom( UdpPacket, 0, 1024, SocketFlags.None, ref tempRemoteEP );

the socket.ReceiveFrom() method may never actually execute, because it is waiting for a packet back from the UDP (DHCP server) server. What I would like to do is wait for n milliseconds, and if the code doesn't execute, then continue with the execution of the program and handle not getting a response back.

What do I need to do, to achieve this?

Thanks,
dave
Reply to this message...
 
    
Devin Rader
Don't know if this thread will help or not..

http://groups.google.com/groups?q=ReceiveFrom+wait+time+group:*dotnet*
<http://groups.google.com/groups?q=ReceiveFrom+wait+time+group:*dotnet*&hl=e
n&selm=14c22f48.0201270524.269b05f4%40posting.google.com&rnum=1>
&hl=en&selm=14c22f48.0201270524.269b05f4%40posting.google.com&rnum=1

(watch wrapping)

Devin

-----Original Message-----
From: dave wanta [mailto:Click here to reveal e-mail address]
Sent: Monday, May 13, 2002 12:47 PM
To: ngfx-io
Subject: [ngfx-io] blocking function call

hi all,
I have a code snippet that I don't know how to handle, and am looking for
direction, examples, etc....

I have some code that could hang indefinitely, and what I need to do is stop
the code from executing if it doesn't execute within n milliseconds.

here is an example.

//build and construct a socket...
// socket code here....
// everything works great..
// but if the socket doesn't get a response back, everything hangs....

socket.ReceiveFrom( UdpPacket, 0, 1024, SocketFlags.None, ref tempRemoteEP
);

the socket.ReceiveFrom() method may never actually execute, because it is
waiting for a packet back from the UDP (DHCP server) server. What I would
like to do is wait for n milliseconds, and if the code doesn't execute, then
continue with the execution of the program and handle not getting a response
back.

What do I need to do, to achieve this?

Thanks,
dave
| [ngfx-io] member Click here to reveal e-mail address = YOUR ID |
http://www.aspfriends.com/aspfriends/ngfx-io.asp = JOIN/QUIT
Reply to this message...
 
 
System.Net.Sockets.SocketFlags




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification