getting broken pipe error(when switching website(webiopi))

This is the place for queries that don't fit in any of the other categories.

getting broken pipe error(when switching website(webiopi))

Postby devidation » Sun May 11, 2014 1:58 pm

I have a little problem that I don't know how to fix.
For a project i'm using html to make a chatbox and webiopi to call functions from python.
When i'm connecting on the same page then everything works fine.
However in my case i made a login window which sends me to the chatbox and at the same time calls the connect function.
Doing it this way gives me "broken pipe" error.
Ofcourse I can just make the login box on the same page as the chatbox but I would like to seperate them.
Does anyone know how to fix this?
Thanks in advance.

Below you can find my code:

Code: Select all
def connect():
   print "You pressed connect"
   global myclient, address
      # TCP server
      serverTest = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #server open a socket
      serverTest.bind(("", 5000))    # socket = ip addres + port
      serverTest.listen(5)                   # server can listen to 5 client
      print "TCP server listening on port 5000"
      myclient, address = serverTest.accept()   # when a client want a connection, the server will accept
      print "Connected to ", address      # print ip addres of the client
      #confirm connection to client
      myclient.send('0')               # send 0 to the client to comfirm itself
      print "test"
      print "Error"

And my html code:
Code: Select all
function login() {
      username = $('#userName').val();
      password = $('#password').val();
      var updateResult = function(macro, args, response) {
         var answer = response;
         if (answer == "succes")
            window.location = "/chatbox.html";         

      webiopi().callMacro("login", [username, password], updateResult);

Posts: 6
Joined: Thu May 08, 2014 2:03 pm

Return to General Coding Help

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests