Skip to content

Connection problems with string URIs #16

@foolswood

Description

@foolswood

If multiple connections are made between a client and a server using a string as the address only the first message will be sent.

The example code below illustrates the issue, when the line is commented out it is broken (the server only receives 1 message), when enabled it works (receiving 5).

I believe this is to do with the fact that connections are cached on the lo_address, which in C you would free to break the connection and allow new ones to form. There's no way to do this from pyliblo at present, and in any case it wouldn't be very pythonic.

A possible solution would be to not expose the Address object in pyliblo and to handle the connection caching in the cython.

Server:

import liblo
s = liblo.Server(9992, liblo.TCP)
s.add_method(
    None, None, lambda *a, **k: print('msg', a, k))
for _ in range(5):
    s.recv()

Client:

import liblo
s = liblo.Server(9991, liblo.TCP)
a = 'osc.tcp://localhost:9992'
#a = liblo.Address(a)
for i in range(5):
    s.send(a, '/shutup', i)

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