473,785 Members | 2,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Non blocking socket send

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.

Feb 8 '06 #1
1 3186
Thanks Vadym.
"Vadym Stetsyak" wrote:
Hello, yaron!

y> under heavy load i get a SocketException when calling socket.Send method
y> on non blocking socket with error code 10035 WSAEWOULDBLOCK.

y> my question is , how do i know the number of bytes that was successfully
y> send (though there was an exception) so i will not have to send the
y> whole buffer again ?

There were no bytes sent as this error indicates that whole operation cannot be completed.

From docs on WSAWOULDBLOCK
"
This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket. It is a nonfatal error, and the operation should be retried later. It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established.
"

So, all you have to do is to retry the send operation.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot

Feb 9 '06 #2

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

Similar topics

1
6985
by: Tim Black | last post by:
My application requires sending a large piece (~2MB) of data to several devices on a network via TCP sockets. I have experimented with different methods for doing this and this has raised some questions about the implementation of Python sockets. (both methods use blocking sockets) Method 1: Calls socket.sendall(data) for each device in sequence, all in a single thread.
4
4378
by: Christopher H. Laco | last post by:
I'm having a problem with the TcpClient that I can only conclude is either a feature, or a complete misunderstanding of the docs on my part. In a nutshell, I'm simply performing the following sequence with a server: connect write(50 bytes) read(2002 bytes) write(50 bytes) read(2002 bytes)
3
3709
by: Robert A. van Ginkel | last post by:
In news:OZ0W9RsdDHA.2432@TK2MSFTNGP10.phx.gbl... I ask the question how I can see if all the data is on the other side of the connection. I got as answer that I should use the blocking property. I tried this I don't see any diffents, I am sending 10Mb and the Send/BeginSend command doesn't wait till the data is on the remotepoint. Can somebody pls. explain this. Regards Robert.
6
4126
by: roger beniot | last post by:
I have a program that launches multiple threads with a ThreadStart method like the following (using System.Net.Sockets.Socket for UDP packet transfers to a server): ThreadStart pseudo code: Connect Receive response Send Connect ACK
4
1576
by: yaron | last post by:
Hi , - how do i complete the non-blocking connect request when using the select method on the client side ? * (or how do i know that the socket is connected, because i read somewhere that there is bug with Socket.Connected) . ** (because i have a problem, the socket that do the connect stay in writable state forever and i don't send nothing on the socket)
4
24185
by: Rollasoc | last post by:
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
0
1402
by: Blog the Haggis | last post by:
Hi all, I've written a program which distributes binary data to a number of clients via TCP. The program runs perfectly unless one of the client programs hangs and then it freezes while waiting for the socket.send(Data) method to complete. I've tried all of these socket options to overcome this event: 'Set send timeout to 2 seconds:
3
8453
by: mp | last post by:
Code is at bottom. Basically, if I turn off socket blocking prior to connecting, I get a "Socket is not connected" error when I try to send data. However, if I do not turn off blocking, OR if I place a print statement anywhere before the send call, it works! WTF? I'd like to understand what's going on in the background here, if you know don't skimp on the details. Thanks
1
3720
by: AlannY | last post by:
Hi there. I'm developing a tool, which uses non-blocking sockets on Linux. When I'm sending something to socket with send(), the return value is -1, which means error. But it's not an error. <errno> indicates that this is EWOULDBLOCK, which means that my request will be async ;-) I want to get number of bytes really written to socket, but not -1 as I get now. switch (errno) { case EWOULDBLOCK:
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10096
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
8982
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
7504
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
5386
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...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
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
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
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.