0

I run a Python program on an embedded system. This system runs a server that creates UNIX sockets.

def com(request):
    my_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    my_socket.connect("/var/run/.json-cgi")
    my_socket.send(request)
    reply = my_socket.recv(4096)
    return repr(reply)

/var/run/.json-cgi is the socket created by the server. I send a http request that I wrote before and I passed in the arg of the function. When I print the reply, I just get ''.

I wonder if my program creates a new socket that has the same path than the server's one or if it uses the socket of the server. I want to use the socket created by the server.

Did I forget something ?

alexis.
  • 13
  • 1
  • 7
  • 1) Is the server actively listening on the socket and accepting connections, and 2) if so, does changing `.send` to `.sendall` change the behaviour? – Jon Clements Apr 03 '15 at 09:19
  • The server is always listening and accepts connections. This socket is also use by lighttpd (with FastCGI) and when I use `HTTPConnection` object on my own system and send data on the url defined by lighttpd, I get a response. Using `.sendall` does not change the behavior, I get the same reply : `''`. – alexis. Apr 03 '15 at 09:26

0 Answers0