Can you post again in plain text? The formatting below
is all messed up, indentation and spacing errors abound.

On 07/05/15 11:56, Stewart Lawton wrote:
Hi I have tried Python TCPIP sockets and Unix sockets
> processed in a python cgi script,

Have you tried opening the same sockets in a script run
in your user space? Its most likely a problem of cgi user
and your user permissions clashing.

#!/usr/bin/envpython
import cgi
import socket
import sys
defhtmlTop():

Note we've lost a space.

  print("""Content-type:text/html\n\n
  <DOCTYPEhtml>
  <html lang="en">
   <head>
        <metacharset="utf-8" />
       <title> MyServer Template </title>
       </head>
       <body>""")

defhtmlTail():
  print("""<body/>
       </html> """   )

defcreSockettoServer():
# Create a TCP/IP socket
    sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    server_address ='../../.././home/johnlawton/workspace/myUnixSock/uds_socket'
    try:
      sock.connect(server_address)
    except socket.error,msg:
      print>>sys.stderr, msg
      sys.exit(1)
#Send data
     message = 'This is the message. It will be repeated.'
#   print >>sys.stderr,'sending "%s"' % message
    sock.sendall(message)
     return

And the indentation above is messed up.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to