Re: communication with a daemon
From: Paul D. Boyle (boyle_at_laue.chem.ncsu.edu)
Date: 08/05/04
- Previous message: Grant Edwards: "Re: TCP/IP, finishing transmission by receiver"
- In reply to: Tobias Wagner: "Re: communication with a daemon"
- Next in thread: Larry I Smith: "Re: communication with a daemon"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 5 Aug 2004 17:59:49 +0000 (UTC)
Tobias Wagner <none@rz.uni-karlsruhe.de> wrote:
: I've tried with Unix Domain Sockets and the gcc extension stdio_filebuf. But
: the problem is that the server does not realize, that he could read some
: data. The server process waits at line "while (client_str >> msg)". Only if
: the client process is killed, the sent message from the client is printed.
: What's wrong?
I don't know for sure, but this sounds like a buffering problem.
It is usually a bad idea to mix higher level I/O functions (e.g. stdio,
iostream) with low level system calls like write(2), read(2). This is
because the higher level calls use internal buffers for I/O efficency,
while the system calls are not buffered. I don't know C++, but in using
C'isms, you could marshall your messages in a buffer with snprintf(3),
then write(2) them.
Any easy way to test the above hypothesis is to fflush() your output
stream on the client end and see if that changes the behavior.
Paul
-- Paul D. Boyle boyle@laue.chem.ncsu.edu North Carolina State University http://www.xray.ncsu.edu
- Previous message: Grant Edwards: "Re: TCP/IP, finishing transmission by receiver"
- In reply to: Tobias Wagner: "Re: communication with a daemon"
- Next in thread: Larry I Smith: "Re: communication with a daemon"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|