0

A unix dgram socket server has already been created.

How to use python or perl to write a client?

Below code is not working, returns "Connection refused". (python 2.7.6)

#!/usr/bin/python

import socket
import os, os.path

path = "/root/hello.sock"
if os.path.exists( path ):
   client = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
   client.sendto("hello, python", "/root/hello.sock")
   client.close()
else:
   print "sock file does not exit"
ptan
  • 169
  • 3
  • 9

0 Answers0