Skip to content

Handle outbound socket connection with file descriptor #1

Description

@kerbsx

The example in wiki is like this:-

import SocketServer
import ESL
 
class ESLRequestHandler(SocketServer.BaseRequestHandler):
    def setup(self):
        print self.client_address, 'connected!'
 
        fd = self.request.fileno()
        print fd
 
        con = ESL.ESLconnection(fd)
        print 'Connected: ', con.connected()
        if con.connected():
 
            info = con.getInfo()
 
            uuid = info.getHeader("unique-id")
            print uuid
            con.execute("answer", "", uuid)
            con.execute("playback", "/ram/swimp.raw", uuid);
         
# server host is a tuple ('host', port)
server = SocketServer.ThreadingTCPServer(('', 8040), ESLRequestHandler)
server.serve_forever()

ESL.ESLconnection() being passed a file descriptor. The current ESLconnection.__init__(self, host, port, password) seem not supporting this.

The __init__ signature for official lib:-

class ESLconnection(builtins.object)
 |  Methods defined here:
 |
 |  __del__ lambda self
 |
 |  __getattr__ lambda self, name
 |
 |  __init__(self, *args)

And the corresponding cpp source:-

ESLconnection::ESLconnection(int socket)
{
	connection_construct_common();
	esl_attach_handle(&handle, (esl_socket_t)socket, NULL);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions