non-blocking

How to make a non-blocking pipe from the command-line in Solaris?

I'm trying to write a lua script that reads input from other processes and analyzes it. For this purpose I'm using io.popen and it works as expected in Windows, but on Unix(Solaris) reading from io.popen blocks, so the script just waits there until something comes along instead of returning immediately... As far as I know I can't change...

Non blocking TCP write(2) succeds but the request is not sent

I am seeing that a small set of message written to a non-blocking TCP socket using write(2) are not seen on the source interface and also not received by the destination. What could be the problem? Is there any way that the application can detect this and retry? while (len > 0) { res = write (c->sock_fd, tcp_buf, len); if (re...

How can I buffer non-blocking IO?

When I need buffered IO on blocking file descriptor I use stdio. But if I turn file descriptor into non-blocking mode according to manual stdio buffering is unusable. After some research I see that BIO can be usable for buffering non-blocking IO. But may be there are other alternatives? I need this to avoid using threads in a multi-co...

Non-blocking Dialog box in Applescript

Hi All, I have to write a small script to deploy a patch for our Application. The patch will replace a couple of files in the application.I decided to depploy the patch using Applescript. The files to be copied are quite large and it takes some time for the files to be copied. I wanted to know if there is any way I can get a dialog box...

What is the difference between lockless and non-blocking?

Hi, In the context of data-structures synchronization, can someone clarify the difference between "lockless" and "non-blocking"? These terms seem to be used interchangeably by a lot of people but I'm not yet sure if there isn't some subtle difference hidden somewhere. I mean lockless is "without locks" and non-blocking is more like gua...

Non Blocking Server in Python

Hi, Can someone please tell how to write a Non-Blocking server code using the socket library alone.Thanks ...

Non Blocking Keyboard on WinCE accessing the virtual keyboard

Hello Guys, I am desperately looking for a solution that enables me to read keyboard events in a non blocking way. These Keyboard events are generated by a VIRTUAL KEYBOARD that comes with the WinCE device. I have a console application running in C++, where the user is asked to navigate via 'ESC', 'U' and other characters through the me...

How to make an accepted socket non-blocking in java

I am accepting a connection from a client and then passing that connected socket off to another object, however, that socket needs to be non-blocking. I'm trying to use getChannel().configureBlocking(false) but that does not seem to be working. It needs to be non-blocking because this the method below is called every 100ms. Is there s...

Should I use (non-blocking) NIO for UDP?

According to this post, UDP just doesn't block. Are there any advantage using the (non-blocking) NIO API for UDP? Or should I just use the easier "traditional" io API? ...

closing non-blocking socket

I have the following code in C. void setNonBlocking(SOCKET fd){ int flags; if (-1 == (flags = fcntl(fd, F_GETFL, 0))) flags = 0; fcntl(fd, F_SETFL, flags | O_NONBLOCK); } int main(){ int sock; connect(sock, .....); setNonBlocking(sock); .... close(sock); //we will do something here but the application exits in/af...

Re-reading from a named pipe when writers come and go.

I've got a problem where I have to read from a named pipe. I have to handle the situation where writers to the named pipe come and go but I need to keep the same pipe open throughout my applications. I have summarised this in the following code. int main( int c, char *v[] ) { int rfd; if ( (rfd = open( PIPENAME, O_RDONLY | O_NO...

Postgres : Post statement (or insert) asynchronous, non-blocking processing.

I'm wondering if it is possible, that after a collection of rows is inserted, to initiate an operation that is executed asynchronously, is non-blocking, and doesn't need to inform the originator of the request - of the result. I am working with large amounts of events and I can guarantee that the post-insert logic will not fail -- I jus...

Can Tornado communicate with Cassandra, in Non-blocking asynchronous style?

I'm working on a web project, which have to process so many client requests. So I am considering to use Cassandra and tornado. Tornado seems to have a build-in client(tornado.httpclient.AsyncHTTPClient), which can do http Non-Blocking request. But, Cassandra uses Thrift protocol. Using Thrift, Tornado seems to be blocked while quering to...

Receiving data with Winsock

Right now, I'm programming the networking for my online game, and I'm not really sure what to do about receiving data. The problem is that I can't really guess the packet's size, so I thought of reading just 4 bytes from the packet and converting them to an int to know what's the packet's size. Then I'll just create a buffer in that siz...

A Question about using jython when run a receving socket in python

Hi, I have not a lot of knowledge of python and network programming. Currently I am trying to implement a simple application which can receive a text message sent by the user, fetch some information from the google search api, and return the results via text message to the user. This application will continue to listening to the users m...

How can I get SQL Server transactions to use record-level locks?

We have an application that was originally written as a desktop app, lo these many years ago. It starts a transaction whenever you open an edit screen, and commits if you click OK, or rolls back if you click Cancel. This worked okay for a desktop app, but now we're trying to move to ADO.NET and SQL Server, and the long-running transactio...

Performing non-blocking requests? - Django

Hi folks, I have been playing with other frameworks, such as NodeJS, lately. I love the possibility to return a response, and still being able to do further operations. e.g. def view(request): do_something() return HttpResponse() do_more_stuff() #not possible!!! Maybe Django already offers a way to perform operations afte...

Is there a posix-way to ensure two files are flushed in sequence without blocking?

In my program, I hold two files open for writing, a content-file, containing chunks of data, and an index-file, containing a map over which chunks of data has been written so far. I would like to flush them both to disc, as performant as possible, with the only constraint that the blocks in the data-file must be written before the corre...

Incremental Stream Parsing in C++

Hi, I am reading data from a (serial) port using a non-blocking read() function (in C/C++). This means the data comes-in in chunks of undetermined (but reported) sizes (incl. 0) each time I "poll" the port. I then need to parse this "stream" for certain patterns (not XML). My naive implementation concatenates the new string to the pre...

select() blocking forever even if timeval is 0 on non-blocking TCP sockets ?

After we do a send(), the error that comes back is EWOULDBLOCK, so then we do a select() with a timeval structure with tv_sec = tv_usec = 0 which should return back immediately, but it doesn't, we are stuck in the select() call, and people have said that have waited over 2 mins, with it still being blocked in the select() call. This is...