nonblocking

How can I get non-blocking socket connect()'s?

Hello there, I have a quite simple problem here. I need to communicate with a lot of hosts simultaneously, but I do not really need any synchronization because each request is pretty self sufficient. Because of that, I chose to work with asynchronous sockets, rather than spamming threads. Now I do have a little problem: The async stuf...

How to provide feedback while loading thumbnails and control the load order

I'm building a website with around 250-300 thumbnails on a single page, contained in 5 different divs which can each be scrolled horizontally. During the loading stage, however, I need to be able to click on a thumbnail and load the full-res picture in the lightbox. I've looked at Jason Buntings answer in How to display loading status w...

Blocking IO vs non-blocking IO; looking for good articles

Once upon a time I bumped into Introduction to Indy article and can't stop thinking about blocking vs non-blocking IO ever since then. Looking for some good articles describing what are pros and cons of blocking IO and non-blocking IO and how to design your application in each case to get natural, easy to understand and easy to maintain...

Non-blocking stdio

I'm working on a program which will be taking in user input from the console as well as printfing out in a separate thread. I want to avoid situations where the user is halfway through typing something in and a printf comes along and prints itself at the cursor. Is there a way to do non-blocking io in c from the console window? Ideally,...

How to do a nonblocking update to a datagridview in c#.

I understand how to use delegates to update controls on the main control thread, works like a charm. My problem here is if I'm adding a large dataset (say 2000 items) to a bound datagridview it takes 5-8 seconds for the grid to populate and during that 5-8 seconds the whole gui is locked. How can I update the datagridview such that it ...

Java: Is SelectionKey.attach() broken?

In my implementation of Java NIO I have not been able to get SelectionKey.attach() to work. Basically, once clients connect (OP_ACCEPT interest ops) I add them to a map where their IP address maps to an object that maintains state for the client. Then, when an OP_READ occurs, I again retrieve the client's IP address, and this time get ...

How to Avoid DOS Attack using Berkeley Sockets in C++

I'm working my way through UNIX Network Programming Volume 1 by Richard Stevens and attempting to write a TCP Echo Client that uses the Telnet protocol. I'm still in the early stages and attempting to write the read and write functions. I'd like to write it to use I/O Multiplexing and the Select function, because it needs to be multi...

Linux TCP/IP Non-blocking send for socket stream..what happens to the TCP recv buffer?

This pertains to Linux kernel 2.6 TCP sockets. I am sending a large amount of data, say 300 MB, with a non-blocking send to another client who receives 8 MB at a time. After one 8 MB receive, the "receiver" stops receiving because it wants to perform other tasks, such as error handling. The sender would get a EWOULDBLOCK, but since ...

Suggestions for a thread safe non-blocking buffer manager

I've created a simple buffer manager class to be used with asyncroneous sockets. This will protect against memory fragmentation and improve performance. Any suggestions for further improvements or other approaches? public class BufferManager { private int[] free; private byte[] buffer; private readonly int blocksize; pu...

Are non blocking IOs still an issue with server side Java?

The Java NIO Socket Framework supposedly hides the dirty details of non-blocking IO from developers, allowing them to build highly scalable applications, which can handle over 10000 incoming and outgoing sockets using only one thread. Are non blocking IOs still a pain with the typical version of Java 2 SE/EE? Is this framework still ne...

Non-Blocking method for parsing (streaming) XML in python

I have an XML document coming in over a socket that I need to parse and react to on the fly (ie parsing a partial tree). What I'd like is a non blocking method of doing so, so that I can do other things while waiting for more data to come in (without threading). Something like iterparse would be ideal if it finished iterating when the r...

Java serialization, ObjectInputStream.readObject(), check if will block

I'm using an ObjectInputStream to call readObject for reading in serialized Objects. I would like to avoid having this method block, so I'm looking to use something like Inputstream.available(). InputStream.available() will tell you there are bytes available and that read() will not block. Is there an equivalent method for seriailzation...

Using multiple sockets, is non-blocking or blocking with select better?

Lets say I have a server program that can accept connections from 10 (or more) different clients. The clients send data at random which is received by the server, but it is certain that at least one client will be sending data every update. The server cannot wait for information to arrive because it has other processing to do. Aside f...

Problem with O_NONBLOCK Pipe

Hi, I'm trying to send and receive using pipes: send.cpp struct { long a; long b; }T; cout << "1" << endl; if ( access ( FIFO_NAME, F_OK ) == -1 ) { res = mkfifo ( FIFO_NAME, 0755 ); if ( res != 0 ) cout << " Can't make fifo" << endl; } cout << "2" << endl; pipe_fd = open ( FIFO_NAME, O_WRONLY); cout << "...

sending a non-blocking HTTP POST request

Hi, I have a two websites in php and python. When a user sends a request to the server I need php/python to send an HTTP POST request to a remote server. I want to reply to the user immediately without waiting for a response from the remote server. Is it possible to continue running a php/python script after sending a response to the u...

Losing bytes on an epoll controlled non-blocking socket when the other side writes and closes

I've a non-blocking socket currently subscribed to: ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP | EPOLLRDHUP| EPOLLET; It receives a couple of EPOLLINs which I read non-blocking till EAGAIN and then I receive HUP & RDHUP, sometimes with a few bytes more to read. The other side is just: send(socket,960_bytes_buffer) close(s...

How to check if stdin is still opened without blocking?

I need my program written in pure C to stop execution when stdin is closed. There is indefinite work done in program main cycle, and there is no way I can use blocking checks (like getc()) there (no data is supposed to arrive on stdin - it just stays opened for unknown time). I intend to use described functionality in realization of ne...

C# non-blocking socket without while(true) loop

I'm just trying to make some socket programming, using non-blocking sockets in c#. The various samples that i've found, such as this, seems to use a while(true) loop, but this approach causes the cpu to burst at 100%. Is there a way to use non-blocking sockets using a event programming style? Thanks ...

[Resolved]Python socket not receiving anything

I'm trying to receive a variable length stream from a camera with python, but get weird behaviour. This is Python 2.6.4 (r264:75706) on linux(Ubuntu 9.10) The message is supposed to come with a static header followed by the size, and rest of the stream. here is the code from socket import * import array import select HOST = '169.254.0...

SSL and NIO Non-blocking Sockets

How do you recommend making a highly scalable SSL client? Currently, I'm using plain Sockets to connect to the Apple APNS server which requires a non-HTTP SSL sockets. I considered using the NIO library, but it is lacking a SSLSocketChannel, and I couldn't find a good library or a smooth tutorial on how to roll out your own. ...