summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
gu.martinm@gmail.com [Sun, 16 Mar 2014 23:20:46 +0000 (00:20 +0100)]
fixed #1. Using execvp instead of system.
gu.martinm@gmail.com [Mon, 10 Mar 2014 02:52:03 +0000 (03:52 +0100)]
Working on issues: #1 #3.
No more shared memory, execv/execl solution.
UTF-8 always between client and server (avoiding issues with strtok)
gu.martinm@gmail.com [Sun, 23 Feb 2014 16:25:12 +0000 (17:25 +0100)]
Avoid SIGPIPE and polite kill child process.
SIGPIPE when using send method and remote side closed connection.
Portable alternatives: sighandler for SIGPIPE or block/ignore SIGPIPE. In some situations we
may not ignore SIGPIPE (if we are writing some API we may not just swallow SIGPIPE) because of that
depending o the situation we could ignore or block SIGPIPE.
There is SIGPIPE JUST when using send/write (no with read/recv) and remote side closed connection.
gu.martinm@gmail.com [Mon, 3 Feb 2014 23:54:46 +0000 (00:54 +0100)]
Wait for client to close connection: improvement (I hope)
gu.martinm@gmail.com [Sun, 2 Feb 2014 20:49:14 +0000 (21:49 +0100)]
Avoid TIME_WAIT state, server side: wait for client to close connection.
See:
http://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable
http://www.serverframework.com/asynchronousevents/2011/01/time-wait-and-its-design-implications-for-protocols-and-scalable-servers.html
http://stackoverflow.com/questions/3757289/tcp-option-so-linger-zero-when-its-required
By the way, never use SO_LINGER. The application level protocol should be implemented
in such way that allows the client side to find out when server side ended up sending
data and in this way the client is able to close the connectiond and server side does not
finish with sockets in TIME_WAIT state.
gu.martinm@gmail.com [Sun, 17 Nov 2013 17:32:51 +0000 (18:32 +0100)]
I do not think daemonize function is needed.
Remove it once I get time and just use setsid function.
Gustavo Martin Morcuende [Thu, 29 Aug 2013 00:51:49 +0000 (02:51 +0200)]
Doubts about setsid. TODO some day.
Gustavo Martin Morcuende [Thu, 29 Aug 2013 00:49:18 +0000 (02:49 +0200)]
How to launch daemon (improvement)
gumartinm [Sun, 20 Jan 2013 21:28:54 +0000 (22:28 +0100)]
Multiple minor changes:
1. Return -1 from main function as error code.
2. Close useless file descriptors in child process.
3. Improving some comments and error messages.
4. Errors from poll function.
gumartinm [Sun, 23 Dec 2012 19:15:17 +0000 (20:15 +0100)]
EXIT_SUCCESS & EXIT_FAILURE constants / _exit
About _exit: I do not think I really need to use _exit but anyway it seems to me like it does not hurt me so... Let's do it in the right way!!!
From: http://www.unixguide.net/unix/programming/1.1.3.shtml / http://stupefydeveloper.blogspot.com.es/2009/01/c-to-exit-or-to-exit.html
There are a few differences between exit() and _exit()
that become significant when fork(), and especially
vfork(), is used.
The basic difference between exit() and _exit() is that
the former performs clean-up related to user-mode constructs in the
library, and calls user-supplied cleanup functions, whereas the latter
performs only the kernel cleanup for the process.
In the child branch of a fork(), it is normally incorrect to use
exit(), because that can lead to stdio buffers being flushed
twice, and temporary files being unexpectedly removed. In C++ code the
situation is worse, because destructors for static objects may be run
incorrectly. (There are some unusual cases, like daemons, where the
parent should call _exit() rather than the child; the
basic rule, applicable in the overwhelming majority of cases, is that
exit() should be called only once for each entry into
main.)
In the child branch of a vfork(), the use of exit() is
even more dangerous, since it will affect the state of the parent
process.
gumartinm [Sun, 23 Dec 2012 18:48:37 +0000 (19:48 +0100)]
Fixed error in sizeof for unsigned char.
gumartinm [Tue, 18 Dec 2012 05:30:04 +0000 (06:30 +0100)]
Right type for storing return code from fork
gumartinm [Tue, 18 Dec 2012 05:25:48 +0000 (06:25 +0100)]
Unblock SIGCHLD signal in child process.
gumartinm [Tue, 18 Dec 2012 04:50:42 +0000 (05:50 +0100)]
Exit from custom SIGINT handler. The right way.
As seen on: http://www.cons.org/cracauer/sigint.html
gumartinm [Tue, 18 Dec 2012 03:46:18 +0000 (04:46 +0100)]
Blocking SIGCHLD with pthread_sigmask
gumartinm [Tue, 18 Dec 2012 01:40:45 +0000 (02:40 +0100)]
Improving the set signal_handler code
gumartinm [Mon, 17 Dec 2012 20:29:33 +0000 (21:29 +0100)]
Using right type for data bytes:
* char:
It is the type that makes up C strings like "abcde"
It also works out as a number value, but it is unspecified whether that value is treated as signed or unsigned. Beware character comparisons through inequalities - although if you limit yourself to ASCII (0-127) you're just about safe.
* signed char:
Gives you at least the -128 to 127 range.
* unsigned char:
Gives you at least the 0 to 255 range.
There is this warning: pointer targets in passing argument 1 of ‘system’ differ in signedness
I guess, it does not hurt me.
gumartinm [Mon, 17 Dec 2012 19:33:22 +0000 (20:33 +0100)]
Check shell has not set up an initial action
gumartinm [Sun, 18 Mar 2012 11:57:11 +0000 (12:57 +0100)]
The daemon process sends to the Java client in case of any error the value -1.
In this way, the Java client's code always will receive a return status from the daemon process
and just in case of any error it receives an error status.
gumartinm [Sun, 4 Mar 2012 20:45:23 +0000 (21:45 +0100)]
XML parser removed. We begin to use my own protocol.
Next step: Java NIO for the Java client code.
gumartinm [Sun, 26 Feb 2012 23:40:33 +0000 (00:40 +0100)]
Comment with questions about packing, serializing and alginment
gumartinm [Sun, 26 Feb 2012 22:03:01 +0000 (23:03 +0100)]
More steps in my JavaTCPForkDaemon.
I must concatenate the protocold header and the payload.
Should I use writev?
gumartinm [Mon, 6 Feb 2012 00:33:35 +0000 (01:33 +0100)]
Some code improvements.
First steps with the new way to send the stdout, stderr and return status code
to the client program. Thinking about a typedef struct, but I am wasting bytes
using this way. Is it worth wasting bytes?
gumartinm [Tue, 31 Jan 2012 06:17:45 +0000 (07:17 +0100)]
Removing some useless white spaces....
Sorry for this commit...
gumartinm [Tue, 31 Jan 2012 05:47:23 +0000 (06:47 +0100)]
Nothing important,
just another english grammar mistake in javafor.c
gumartinm [Mon, 30 Jan 2012 22:47:56 +0000 (23:47 +0100)]
Clening up code, and errors control.
TODO: stop using XML, I am going to use my own protocol for
sending stdout, stderr and return status code in this way
I will avoid the shared memory and the code complexity.
Besides it should reduce the memory usage.
Next weekend more.
gumartinm [Sun, 29 Jan 2012 23:44:01 +0000 (00:44 +0100)]
New nice method to read data from socket.
Some useless comments just left to remind me what I am going to do the next week.
Just is left to improve the fork_system function (IMHO)
gumartinm [Sun, 29 Jan 2012 16:07:40 +0000 (17:07 +0100)]
Some minor changes in REAME files
gumartinm [Sun, 29 Jan 2012 16:03:23 +0000 (17:03 +0100)]
Grammar mistake in README file :/
gumartinm [Sun, 29 Jan 2012 16:01:27 +0000 (17:01 +0100)]
Removing executable file
gumartinm [Sun, 29 Jan 2012 16:00:44 +0000 (17:00 +0100)]
first commit