juce / sockproc Goto Github PK
View Code? Open in Web Editor NEWSockproc is a simple server for running child processes or shell commands
License: MIT License
Sockproc is a simple server for running child processes or shell commands
License: MIT License
gcc49 -Wall -Werror -o sockproc sockproc.c
sockproc.c: In function 'main':
sockproc.c:304:35: error: invalid application of 'sizeof' to incomplete type 'struct sockaddr_in'
memset(&addr_in, 0, sizeof(addr_in));
^
sockproc.c:305:9: error: invalid use of undefined type 'struct sockaddr_in'
addr_in.sin_family = AF_INET;
^
sockproc.c:306:9: error: invalid use of undefined type 'struct sockaddr_in'
addr_in.sin_port = htons(port);
^
sockproc.c:307:9: error: invalid use of undefined type 'struct sockaddr_in'
addr_in.sin_addr.s_addr = inet_addr("127.0.0.1");
^
sockproc.c:308:56: error: invalid application of 'sizeof' to incomplete type 'struct sockaddr_in'
if (bind(fd, (struct sockaddr*)&addr_in, sizeof(addr_in)) == -1) {
^
*** Error code 1
Stop.
user git clone no get the progress util wait git clone over
Have you considered reinventing the sockproc protocol to serve data in chunks? Say for example
for generating an archive dynamically, seems to me you need to allocate the size of the output, then
write everything to the socket?
Hello there! How to install this
Tests failing
make[1]: Entering directory `/root/temp/rcv-nginx/.build/sockproc/build/sockproc-master'
cc -Wall -Werror -o sockproc sockproc.c
./tests.sh 12345
+ port=12345
+ pidfile=/tmp/sockproc-test.pid
+ ./sockproc 12345 /tmp/sockproc-test.pid
+ echo -e =========================
=========================
+ echo -e 'uname -a\r\n0\r\n'
+ nc 127.0.0.1 12345
status:0
115
Linux rnd01-k01-jnk01 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
0
Ncat: Connection reset by peer.
make[1]: *** [test] Error 1
make[1]: Leaving directory `/root/temp/rcv-nginx/.build/sockproc/build/sockproc-master'
Update
Tried to use the built sockproc.
It is not working with Lua Resty Shell
2018-11-01T09:54:31+00:00 rnd01-t13-vgw01 ERR nginx_error: 2018/11/01 09:54:31 [error] 22443#22443: *486 connect() to unix:/var/run/ringcentral/vgw/vgw-shell.sock failed (111: Connection refused) while sending to client, client: 10.62.19.12, server: vi6-1-vgw-maintenance.*, request: "GET /localapi/vgw/v1/healthcheck HTTP/1.1", host: "rnd01-t13-vgw01.lab.nordigy.ru:9301"
2018-11-01T09:54:31+00:00 rnd01-t13-vgw01 ERR nginx_error: 2018/11/01 09:54:31 [error] 22443#22443: *486 [lua] vgw-healthcheck.lua:61: Error during calculating VGW uptime, exit-code -2 while sending to client, client: 10.62.19.12, server: vi6-1-vgw-maintenance.*, request: "GET /localapi/vgw/v1/healthcheck HTTP/1.1", host: "rnd01-t13-vgw01.lab.nordigy.ru:9301"
2018-11-01T09:54:31+00:00 rnd01-t13-vgw01 ERR nginx_error: 2018/11/01 09:54:31 [error] 22443#22443: *486 [lua] vgw-healthcheck.lua:62: StdOut: '' while sending to client, client: 10.62.19.12, server: vi6-1-vgw-maintenance.*, request: "GET /localapi/vgw/v1/healthcheck HTTP/1.1", host: "rnd01-t13-vgw01.lab.nordigy.ru:9301"
2018-11-01T09:54:31+00:00 rnd01-t13-vgw01 ERR nginx_error: 2018/11/01 09:54:31 [error] 22443#22443: *486 [lua] vgw-healthcheck.lua:63: StdErr: 'connection refused' while sending to client, client: 10.62.19.12, server: vi6-1-vgw-maintenance.*, request: "GET /localapi/vgw/v1/healthcheck HTTP/1.1", host: "rnd01-t13-vgw01.lab.nordigy.ru:9301"
I'm having trouble making sockproc work in a docker container. I tested it ok on my mac. Then I built it in an ubuntu docker container. The process appears to start ok, but I can't telnet to the socket.
Here's the command output:
root@311718b99310:/usr/local/bin# ./sockproc /tmp/foo
root@311718b99310:/usr/local/bin# ps aux |grep sock
root 33 0.0 0.0 4364 84 ? Ss 03:44 0:00 ./sockproc /tmp/foo
root@311718b99310:/usr/local/bin# telnet /tmp/foo
telnet: could not resolve /tmp/foo/telnet: Name or service not known
Ideas or things I can do to help debug? Thanks.
If scokproc is forked by a process whose stdin, stdout, stderr file descriptors closed, the listening socket will be closed by daemon.And accept call return error of Socket operation on non-socket.How to solve this issue?
make[1]: *** [test] Error 1
make[1]: Leaving directory `/root/temp/rcv-nginx/.build/sockproc/build/sockproc-master'
make: *** [/root/temp/rcv-nginx//.build/sockproc/build/sockproc-master/sockproc] Error 2
[root@rnd01-k01-jnk01 rcv-nginx]# netstat -lptn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 974/sshd
tcp 0 0 127.0.0.1:12345 0.0.0.0:* LISTEN 11583/./sockproc
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1544/master
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 3581/zabbix_agentd
tcp 0 0 0.0.0.0:514 0.0.0.0:* LISTEN 731/rsyslogd
tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN 970/snmpd
tcp 0 0 0.0.0.0:9001 0.0.0.0:* LISTEN 1185/python
tcp6 0 0 :::10050 :::* LISTEN 3581/zabbix_agentd
This could prevent further builds from succeeding.
To avoid this, you should probably wrap test.sh
script and kill pid from this wrapper.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.