473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Handle network timeout in C#

HI,

I need to set the timeout value for the sockets to handle network
timeout in C#. I search for some API which is equivalent to that of the
setSoTimeout() method in Java.

Could any one of you please help me out?

Thanks,
Palaniappan.

Jul 7 '06 #1
1 3089
Palaniappan wrote:
HI,

I need to set the timeout value for the sockets to handle network
timeout in C#. I search for some API which is equivalent to that of the
setSoTimeout() method in Java.

Could any one of you please help me out?

Thanks,
Palaniappan.
Hi Palaniappan,

If you have a socket object, you can do this:

///
mySocketObj.SetSocketOption( SocketOptionLevel.Socket,
SocketOptionName.SendTimeout,
1000 );
///

This will set the send timeout to 1000 milliseconds. Setting the receive
timeout is just as easy ;-)

Remember though, these timeouts have no meaning when using the asynchronous
send/receive methods; they are only of use when using the synchronous
operations.

--
Hope this helps,
Tom Spink
Jul 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dicky Cheng | last post by:
Hi, I am using .net remoting technology. I set up a .net remoting client and server in IIS. When the client calls the server, the server will run a long duration method (30-60seconds). I have a...
3
by: Yong | last post by:
I get a general network error when I try to make asynchronously call ExecuteNonQuery on long sql statements that run in parallel. Here is the background info on what I'm trying to accomplish: I...
0
by: Yong | last post by:
I'm not getting any reply to my previous thread so I'm stating a new one. I get a General Network Error due to my SqlCommand object not having a big enough CommandTimeout to complete very long...
0
by: Brian Pearson | last post by:
Hi, I'm wondering how I can find out when a request timeout has occurred and handle it programmatically. Here's is what I have so far: // This handler is added to the web application's...
4
by: dumbkiwi | last post by:
I have written a script that uses the urllib2 module to download web pages for parsing. If there is no network interface, urllib2 hangs for a very long time before it raises an exception. I...
0
by: Kyle Freeman | last post by:
Ive been experimenting with ways to discover computers on the network. Most of what I have tried is centered around looping through our network address ranges to discover the names of the...
8
by: dmoore | last post by:
Hi folks, I've seen the following issue come up in multiple posts to this mailing list: I have a python program that spawns a child process with popen or popen2 or popen3 or popen2.popen2...
6
by: =?Utf-8?B?VGlt?= | last post by:
I have an app that calls a webmethod. Everything works fine except when you, the client, loses network connectivity during the request. When the connection is lost the client applications hangs. ...
1
by: Ryan Liu | last post by:
Hi, I have a 100 clients/ one server application, use ugly one thread pre client approach. And both side user sync I/O. I frequently see the error on server side(client side code is same, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.