flush

How to force flushing in Grails GORM

孤者浪人 提交于 2019-12-24 03:51:50
问题 I have a service that distributes tasks to operators. Inside a method I distribute many tasks in time inside a loop. I want to flush the task, the operator, and a DistributionLog. If I just had one domain to save I think I could do something like Operator.withTransaction{ //...some code } but I have at least 3 domains to save and to make it even worse, two of them have dependency on each other. The operator have a list of tasks. I can't wait all the distribution to finish before an operator

Non-blocking TCP socket and flushing right after send?

回眸只為那壹抹淺笑 提交于 2019-12-24 01:55:20
问题 I am using Windows socket for my application(winsock2.h). Since the blocking socket doesn't let me control connection timeout, I am using non-blocking one. Right after send command I am using shutdown command to flush(I have to). My timeout is 50ms and the thing I want to know is if the data to be sent is so big, is there a risk of sending only a portion of data or sending nothing at all? Thanks in advance... hSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); u_long iMode=1; ioctlsocket

Java Socket OutputStream is not flushing

北慕城南 提交于 2019-12-23 17:37:03
问题 I am writing a socket-based server in java. A client connects to it(a web-browser) and the server sends back a simple html code and sets cookie to recognize next time client connects to it again. I am using PrintStream to write to the socket , but flush is not working. The only way i can flush is to use shutdownoutput or close and both close the socket stream. But i do not want that because i am readin/writing to it several times in several places in the code. What can do? Could't get any

DataOutputStream not flushing

狂风中的少年 提交于 2019-12-23 04:47:47
问题 I have a Java Client which sends UTF-8 strings to a C# TCP-Server, I'm using a DataOutputStream to send the strings. The code looks like this: public void sendUTF8String(String ar) { if (socket.isConnected()) { try { dataOutputStream.write(ar.getBytes(Charset.forName("UTF-8"))); dataOutputStream.flush(); } catch (IOException e) { handleException(e); } } } The problem is that flush doesn't seem to work right. If I send two Strings close to each other, the server receives only one message with

Cannot cin.ignore till EOF?

丶灬走出姿态 提交于 2019-12-23 03:07:54
问题 I wanted to ignore all characters in cin to flush cin in this answer: How to get rid of bad input one word at a time instead of one line at a time? But I found that the program seemed to hang awaiting input if I wrote: cin.ignore(std::numeric_limits<std::streamsize>::max()); It propperly flushed cin if I used the '\n' delimiter: cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); My question is, why can't I just ignore till EOF? Why do I have to provide the delimiter? 回答1: The

Print out the output of os.popen() without buffering in python

℡╲_俬逩灬. 提交于 2019-12-22 09:56:29
问题 Let's say that I have a process that prints out some data something like this ruby code. 1.upto(10) { |i| puts i puts "\n" sleep 0.6 } I want to have a python code that spawns this process, and read data from it to print it out. import os import sys cmd = "ruby /Users/smcho/Desktop/testit.rb"; pingaling = os.popen(cmd,"r") while 1: line = pingaling.readline() if not line: break print line, sys.stdout.flush() pingaling.close() The problem of this code is that it doesn't print the number one by

ASP Response.Flush() flushes partial data

安稳与你 提交于 2019-12-22 09:46:48
问题 I am developing a web app with an ASP server side and I use an iframe for data push. An ASP handler flushes every once in a while some javascript to the iframe: context.Response.Write("<script language='javascript'>top.update('lala');</script>"); context.Response.Flush(); My problem is that sometimes, when I receive the data, I don't get the full text. For example I will receive this : <script language='javascript'>update('lala');</ Unfortunately this prevents the javascript code from being

Adding a cookie to the response in Java after the header has been flushed?

Deadly 提交于 2019-12-22 01:19:49
问题 I have a custom tag that does some processing and then sets a cookie. However, the cookie wasn't being set, and I couldn't figure out why. Another developer pointed out that because we're using a template system, the point at which the tag evaluates, the response header has already been flushed as a part of an include. Since the header has been sent, it doesn't look possible to add the cookie (however, no state exceptions are thrown when I try to do it). Is there a way around this? Does this

What is checked behind FlushMode.AUTO?

心不动则不痛 提交于 2019-12-21 18:36:10
问题 In Hibernate, I wonder which conditions trigger flushing when flushMode is AUTO? It may be complex (or "magic") but what are the basic conditions? Thanks 回答1: When flush mode is FlushMode.AUTO it will happen at following times: Before a query is executed When a Transaction on the Hibernate API is committed When the application calls session.flush() explicitly The purpose of this mode is to avoid 'stale' state. Changes made to objects in memory may conflict with the results of the query. My

When to flush a file in Go?

泄露秘密 提交于 2019-12-21 07:24:44
问题 When is it necessary to flush a file? I never do it because I call File.Close and I think that it is flushed automatically, isn't it? 回答1: You'll notice that an os.File doesn't have a .Flush() because it doesn't need one because it isn't buffered. Writes to it are direct syscalls to write to the file. When your program exits(even if it crashes) all files it has open will be closed automatically by the operating system and the file system will write your changes to disk when it gets around to