473,395 Members | 1,762 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,395 software developers and data experts.

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 24157

"Rollasoc" <ro******@hotmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.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******@hotmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.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
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;...
4
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...
0
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
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...
9
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...
1
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...
0
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 =...
4
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:...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.