473,796 Members | 2,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Socket Exception: A non blocking socket operation could not be completed immediately.

Hi,

We have a range of four products that can talk to our software (Written
in C# & managed C++) via ethernet. Using standard socket class.

This has all been working fine for a long time now, under DotNet 1.1.

We have now converted the project to DotNet 2.0

Unfortunetely, the code no longer works for one of the products. The
other three are fine.

Now, when we try and communicate, we get the following error

"A non blocking socket operation could not be completed immediately".

I'd be open to suggestions on how to fix this, having spent several
days googling for an answer, I have yet to find one that works.

The other question is "What else has MS changed in functionality whilst
keeping the interface the same, that I may software may trip up on with
the ported code?"

Chris
http://www.hairthieves.com

Sep 13 '06 #1
4 24187

"Rollasoc" <ro******@hotma il.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
Hi,

We have a range of four products that can talk to our software (Written
in C# & managed C++) via ethernet. Using standard socket class.

This has all been working fine for a long time now, under DotNet 1.1.

We have now converted the project to DotNet 2.0

Unfortunetely, the code no longer works for one of the products. The
other three are fine.

Now, when we try and communicate, we get the following error

"A non blocking socket operation could not be completed immediately".
....

This is actually not an error. You are using non-blocking socket (is this
your intention?) and this "error" is normal flow of processing in such case
(WSAEWOULDBLOCK in win32 api) and you have to handle it gracefully. You'll
have to be more specific about the problem.

Regards,
Goran
Sep 13 '06 #2

Goran Sliskovic wrote:
This is actually not an error. You are using non-blocking socket (is this
your intention?) and this "error" is normal flow of processing in such case
(WSAEWOULDBLOCK in win32 api) and you have to handle it gracefully. You'll
have to be more specific about the problem.

Regards,
Goran
I think the main problem is I didn't get the error on Dotnet 1.1 and
now do on Dotnet 2.0.
The code at our end hasn't changed and is essentially the same code
for all 4 products. Why it is fine on three of them and not the other
one is a mystery.

I'll do some more research on WSAEWOULDBLOCK and how to gracefully
handle it however and get back with any findings.

Rollasoc
http://www.hairthieves.com

Sep 14 '06 #3

"Rollasoc" <ro******@hotma il.comwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.com.. .
....
>
I think the main problem is I didn't get the error on Dotnet 1.1 and
now do on Dotnet 2.0.
The code at our end hasn't changed and is essentially the same code
for all 4 products. Why it is fine on three of them and not the other
one is a mystery.

I'll do some more research on WSAEWOULDBLOCK and how to gracefully
handle it however and get back with any findings.
....
I don't know whether something changed between 1.1 and 2.0, but:
WSAEWOULDBLOCK you would get with non blocking socket in case of:
connect call
read call when no data is buffered
send call when send buffer is full
probbaly shutdown with SO_LINGER on...

This is rather common. You have to wait a bit and issue request again (or
poll socket for for read/write). This is usually done with select call in
API.

If you don't handle it, I'm really surprised how it worked in 1.1. In some
cases you may get lucky because of timings and implementation and very
rarelly get this error.

Regards,
Goran
Sep 14 '06 #4

Goran Sliskovic wrote:
...
I don't know whether something changed between 1.1 and 2.0, but:
WSAEWOULDBLOCK you would get with non blocking socket in case of:
connect call
read call when no data is buffered
send call when send buffer is full
probbaly shutdown with SO_LINGER on...

This is rather common. You have to wait a bit and issue request again (or
poll socket for for read/write). This is usually done with select call in
API.

If you don't handle it, I'm really surprised how it worked in 1.1. In some
cases you may get lucky because of timings and implementation and very
rarelly get this error.

Regards,
Goran
Goran,

Thank you for the reply. I can only assume it is some sort of timing
thing, maybe MS made the code more efficient or something. It is a
bit of a worry that it seem to be ok when talking to our other
products.

I will investigate further next week and try some sort of retry
mechanism. (not sure why it comes back with this error and not a
timeout error?). It is happening on a receive function call by the
way.

Thanks again.

Rollasoc
http://www.hairthieves.com

Sep 15 '06 #5

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

Similar topics

4
16832
by: Joe Kinsella | last post by:
The following code behaves differently from what I would expect: socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp); socket.Blocking = false; socket.Connect(ipe); isConnected = socket.Poll(30*1000000, SelectMode.SelectWrite); I would have expected that once I set the socket to non-blocking, the connect would return immediately and the poll would wait up to 30 seconds
4
18137
by: Chris Tanger | last post by:
Context: C# System.Net.Sockets Socket created with constructor prarmeters Internetwork, Stream and TCP everything else is left at the default parameters and options except linger may be changed as I find appropriate. I am using the socket asynchronously by calling the BeingSend and BeginReceive calls. I would like to be able to call shutdown and close asynchronously if possible.
0
1422
by: yaron | last post by:
Hi, I want to use non-blocking socket operations (and not async socket operations) When i use this code : socket.Blocking = false; socket.Connect(remote); i get this error :
0
256
by: yaron | last post by:
Hi, 1. It seems to me that there is a bug when using non-blocking socket connect operation, because the LocalEndPoint, RemoteEndPoint of the Socket are nulls on the client side. 2. If it is a bug, is there any hotfix for this ? Thanks.
9
1631
by: yaron | last post by:
Hi, 1. It seems to me that there is a bug when using non-blocking socket connect operation, because the LocalEndPoint, RemoteEndPoint of the Socket are nulls on the client side although that the client and the server are already connected. 2. If it is a bug, is there any hotfix for this ? Thanks.
1
3189
by: yaron | last post by:
Hi all, under heavy load i get a SocketException when calling socket.Send method on non blocking socket with error code 10035 WSAEWOULDBLOCK. my question is , how do i know the number of bytes that was successfully send (though there was an exception) so i will not have to send the whole buffer again ? Thanks.
0
2279
by: crescent_au | last post by:
Hi all, I am having problem with the file() function. In my code, I have file() function like this: $url = "http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=$frompcode&Destination_Postcode=$topcode&Country=AU&Weight=$sweight&Service_Type=STANDARD&Height=$sheight&Width=$swidth&Length=$slength&Quantity=$shipping_num_boxes"; $myfile = file($url); when I run my file in localhost, I get the following:
4
15308
by: keithseah | last post by:
Hi all, i've been having this problem and its kiiling me! i'm a newbie at this so i hope someone would be able to help me. picture link: http://i98.photobucket.com/albums/l272/rachelyeo/ErrorWebApplication2.jpg this pops up whenever i click on the Disconnect button after i have connected. these are the following codes for the program.
0
9530
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10182
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7552
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6793
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5445
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.