Csound Csound-dev Csound-tekno Search About

[Csnd] OSCsend INIT ERROR: creating socket

Date2019-05-21 09:06
FromTarmo Johannes
Subject[Csnd] OSCsend INIT ERROR: creating socket
AttachmentsNone  None  osc-send-test.csd  

Date2019-05-21 10:33
FromVictor Lazzarini
SubjectRe: [Csnd] OSCsend INIT ERROR: creating socket
Here both OSCSend_lo and OSCSend have issues.

The problem with OSCSend is that you are trying to open the same socket several times, it will never work. It is the same
instance of the opcode running initialisation several times. What I can do is prevent that happening (if init is done, then don’t do it again).

Messages are only actually sent at k-time.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 21 May 2019, at 09:06, Tarmo Johannes  wrote:
> 
> Hi,
> 
> In one application I had problems with Csound native OSCsend (not using liblo) - when sending many messages, at some point it ended with error:
> INIT ERROR in instr 3 line 44: creating socket
> 
> with OSCsend_lo it worked.
> 
> I made a test csd and discovered that it only happens when OSCsend is called at init time. If it is called at k-time there is no such problem.
> 
> See the attached file -
> instr 3 (OSCsend on init time) fails with around 90..100 calls in the loop.
> instr 2 works (both OSCsend and OSCsend_lo called on first k-cycle)
> 
> I found solution for myself but if there is something to check in the code, maybe it is helpful.
> 
> Tested on Linux, Csound version 6.13 beta (double samples) May 21 2019
> 
> tarmo
> 
> 
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-05-21 12:45
FromTarmo Johannes
SubjectRe: [Csnd] OSCsend INIT ERROR: creating socket
Hm,

But if I want to send to different hosts in the same cycle, it should need separate sockets anyway, right? How is it done in the opcode - the socket is opened in init time? When is it closed?

The strange thing is that the error happens after a while as if there were some limit for opening a certain number of sockets?

In another application I try the OSCsend as one call in separate instrument thus it is not run in loop. Still similar Cannot open socket error happens after a while.
No problem with liblo version. I would be most happy to get rid of the liblo dependency though...

Tarmo

T, 21. mai 2019 12:33 Victor Lazzarini <Victor.Lazzarini@mu.ie> kirjutas:
Here both OSCSend_lo and OSCSend have issues.

The problem with OSCSend is that you are trying to open the same socket several times, it will never work. It is the same
instance of the opcode running initialisation several times. What I can do is prevent that happening (if init is done, then don’t do it again).

Messages are only actually sent at k-time.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 21 May 2019, at 09:06, Tarmo Johannes <trmjhnns@GMAIL.COM> wrote:
>
> Hi,
>
> In one application I had problems with Csound native OSCsend (not using liblo) - when sending many messages, at some point it ended with error:
> INIT ERROR in instr 3 line 44: creating socket
>
> with OSCsend_lo it worked.
>
> I made a test csd and discovered that it only happens when OSCsend is called at init time. If it is called at k-time there is no such problem.
>
> See the attached file -
> instr 3 (OSCsend on init time) fails with around 90..100 calls in the loop.
> instr 2 works (both OSCsend and OSCsend_lo called on first k-cycle)
>
> I found solution for myself but if there is something to check in the code, maybe it is helpful.
>
> Tested on Linux, Csound version 6.13 beta (double samples) May 21 2019
>
> tarmo
>
>
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here<osc-send-test.csd>


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-05-21 13:21
FromVictor Lazzarini
SubjectRe: [Csnd] OSCsend INIT ERROR: creating socket
you need separate instances. That's the case for the older version as well. You can't put it in a loop. Needs to be done as a recursive code, if you wish.

if there is a problem outside a loop, we're happy to look at it. I don't know if there is a time constraint in opening sockets, but I would not think so.

Oeyvind could also tell us if he ran into similar issues, since he's used these in very challenging setups.

Note that liblo has not gone away as the listening code uses it.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 21 May 2019, at 12:46, Tarmo Johannes <trmjhnns@gmail.com> wrote:

Hm,

But if I want to send to different hosts in the same cycle, it should need separate sockets anyway, right? How is it done in the opcode - the socket is opened in init time? When is it closed?

The strange thing is that the error happens after a while as if there were some limit for opening a certain number of sockets?

In another application I try the OSCsend as one call in separate instrument thus it is not run in loop. Still similar Cannot open socket error happens after a while.
No problem with liblo version. I would be most happy to get rid of the liblo dependency though...

Tarmo

T, 21. mai 2019 12:33 Victor Lazzarini <Victor.Lazzarini@mu.ie> kirjutas:
Here both OSCSend_lo and OSCSend have issues.

The problem with OSCSend is that you are trying to open the same socket several times, it will never work. It is the same
instance of the opcode running initialisation several times. What I can do is prevent that happening (if init is done, then don’t do it again).

Messages are only actually sent at k-time.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 21 May 2019, at 09:06, Tarmo Johannes <trmjhnns@GMAIL.COM> wrote:
>
> Hi,
>
> In one application I had problems with Csound native OSCsend (not using liblo) - when sending many messages, at some point it ended with error:
> INIT ERROR in instr 3 line 44: creating socket
>
> with OSCsend_lo it worked.
>
> I made a test csd and discovered that it only happens when OSCsend is called at init time. If it is called at k-time there is no such problem.
>
> See the attached file -
> instr 3 (OSCsend on init time) fails with around 90..100 calls in the loop.
> instr 2 works (both OSCsend and OSCsend_lo called on first k-cycle)
>
> I found solution for myself but if there is something to check in the code, maybe it is helpful.
>
> Tested on Linux, Csound version 6.13 beta (double samples) May 21 2019
>
> tarmo
>
>
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here<osc-send-test.csd>


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-05-21 14:33
FromOeyvind Brandtsegg
SubjectRe: [Csnd] OSCsend INIT ERROR: creating socket
Hi,
I haven't run into similar problems,
but I haven't switched destinations quickly like this.
However, I can anticipate that there could be an error caused by opening a port, then closing it, and then opening it again, all in quick succession. The port may not have been completely freed immediately when closing it, and then the subsequent attempt to open it would fail. Beware I am just guessing here, but it seems it *could* be an explanation to what you observe.
Oeyvind

tir. 21. mai 2019 kl. 14:21 skrev Victor Lazzarini <Victor.Lazzarini@mu.ie>:
you need separate instances. That's the case for the older version as well. You can't put it in a loop. Needs to be done as a recursive code, if you wish.

if there is a problem outside a loop, we're happy to look at it. I don't know if there is a time constraint in opening sockets, but I would not think so.

Oeyvind could also tell us if he ran into similar issues, since he's used these in very challenging setups.

Note that liblo has not gone away as the listening code uses it.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 21 May 2019, at 12:46, Tarmo Johannes <trmjhnns@gmail.com> wrote:

Hm,

But if I want to send to different hosts in the same cycle, it should need separate sockets anyway, right? How is it done in the opcode - the socket is opened in init time? When is it closed?

The strange thing is that the error happens after a while as if there were some limit for opening a certain number of sockets?

In another application I try the OSCsend as one call in separate instrument thus it is not run in loop. Still similar Cannot open socket error happens after a while.
No problem with liblo version. I would be most happy to get rid of the liblo dependency though...

Tarmo

T, 21. mai 2019 12:33 Victor Lazzarini <Victor.Lazzarini@mu.ie> kirjutas:
Here both OSCSend_lo and OSCSend have issues.

The problem with OSCSend is that you are trying to open the same socket several times, it will never work. It is the same
instance of the opcode running initialisation several times. What I can do is prevent that happening (if init is done, then don’t do it again).

Messages are only actually sent at k-time.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 21 May 2019, at 09:06, Tarmo Johannes <trmjhnns@GMAIL.COM> wrote:
>
> Hi,
>
> In one application I had problems with Csound native OSCsend (not using liblo) - when sending many messages, at some point it ended with error:
> INIT ERROR in instr 3 line 44: creating socket
>
> with OSCsend_lo it worked.
>
> I made a test csd and discovered that it only happens when OSCsend is called at init time. If it is called at k-time there is no such problem.
>
> See the attached file -
> instr 3 (OSCsend on init time) fails with around 90..100 calls in the loop.
> instr 2 works (both OSCsend and OSCsend_lo called on first k-cycle)
>
> I found solution for myself but if there is something to check in the code, maybe it is helpful.
>
> Tested on Linux, Csound version 6.13 beta (double samples) May 21 2019
>
> tarmo
>
>
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here<osc-send-test.csd>


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-05-21 20:08
FromTarmo Johannes
SubjectRe: [Csnd] OSCsend INIT ERROR: creating socket
Attachmentsosc-send-test.csd  
Hi,

I made some more tests:

moving OSCsend to separate instrument ie calling it in separate instances does not make difference. Also it is not the amount of calls that is made at once -  I stopped increasing the amount of adresses and set it to modest 10 (ie a message is sent to 10 addresses 4 times per second) -  the system lasts for longer, but sooner or later still the 
"Error: ... creating socket" appears.

Also calling the mySendOsc instrument not in the same time (every instance after 10 k-cyclec) did not make difference.

My guess is that there is still something in OSCsend that does not close the sockets properly and at some point it hits some limit. OSC_lo works as expected.

Maybe there is something wrong in my logic or system setup... Please test with the csd attached.

Thanks!
tarmo

-----

<CsoundSynthesizer>

<CsOptions>

-odac -d

</CsOptions>

<CsInstruments>


sr = 44100

nchnls = 2

0dbfs = 1

ksmps = 32


; schedule 1,0,10

instr 1

kcount init 80

if (metro(4)==1) then

event "i", 2, 0, 0, kcount ; call OSC from different instances

;kcount +=1

endif

endin



instr 2

icount = p4 ; how many addresses to send the message to

print icount

index = 0

iport = 6006

while index < icount do

Shost sprintfk "127.0.0.%d", 1+(index%64)

schedule "mySendOsc",(index*10)/kr,0.1, Shost, iport ; do not call in the same time

;schedule "mySendOsc",0,0.1, Shost, iport ; all in same time

index += 1

od


endin


instr mySendOsc

p3= 0.1

Shost strget p4

iport = p5

OSCsend 1, Shost, iport, "/native", "i", int(random:k(1000,2000))

;OSCsend_lo 1, Shost, iport, "/liblo", "i", int(random:k(10,99))

endin


</CsInstruments>

<CsScore>

i 1 0 60

</CsScore>

</CsoundSynthesizer>




----




Kontakt Oeyvind Brandtsegg (<oyvind.brandtsegg@ntnu.no>) kirjutas kuupäeval T, 21. mai 2019 kell 16:34:
Hi,
I haven't run into similar problems,
but I haven't switched destinations quickly like this.
However, I can anticipate that there could be an error caused by opening a port, then closing it, and then opening it again, all in quick succession. The port may not have been completely freed immediately when closing it, and then the subsequent attempt to open it would fail. Beware I am just guessing here, but it seems it *could* be an explanation to what you observe.
Oeyvind

tir. 21. mai 2019 kl. 14:21 skrev Victor Lazzarini <Victor.Lazzarini@mu.ie>:
you need separate instances. That's the case for the older version as well. You can't put it in a loop. Needs to be done as a recursive code, if you wish.

if there is a problem outside a loop, we're happy to look at it. I don't know if there is a time constraint in opening sockets, but I would not think so.

Oeyvind could also tell us if he ran into similar issues, since he's used these in very challenging setups.

Note that liblo has not gone away as the listening code uses it.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 21 May 2019, at 12:46, Tarmo Johannes <trmjhnns@gmail.com> wrote:

Hm,

But if I want to send to different hosts in the same cycle, it should need separate sockets anyway, right? How is it done in the opcode - the socket is opened in init time? When is it closed?

The strange thing is that the error happens after a while as if there were some limit for opening a certain number of sockets?

In another application I try the OSCsend as one call in separate instrument thus it is not run in loop. Still similar Cannot open socket error happens after a while.
No problem with liblo version. I would be most happy to get rid of the liblo dependency though...

Tarmo

T, 21. mai 2019 12:33 Victor Lazzarini <Victor.Lazzarini@mu.ie> kirjutas:
Here both OSCSend_lo and OSCSend have issues.

The problem with OSCSend is that you are trying to open the same socket several times, it will never work. It is the same
instance of the opcode running initialisation several times. What I can do is prevent that happening (if init is done, then don’t do it again).

Messages are only actually sent at k-time.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 21 May 2019, at 09:06, Tarmo Johannes <trmjhnns@GMAIL.COM> wrote:
>
> Hi,
>
> In one application I had problems with Csound native OSCsend (not using liblo) - when sending many messages, at some point it ended with error:
> INIT ERROR in instr 3 line 44: creating socket
>
> with OSCsend_lo it worked.
>
> I made a test csd and discovered that it only happens when OSCsend is called at init time. If it is called at k-time there is no such problem.
>
> See the attached file -
> instr 3 (OSCsend on init time) fails with around 90..100 calls in the loop.
> instr 2 works (both OSCsend and OSCsend_lo called on first k-cycle)
>
> I found solution for myself but if there is something to check in the code, maybe it is helpful.
>
> Tested on Linux, Csound version 6.13 beta (double samples) May 21 2019
>
> tarmo
>
>
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here<osc-send-test.csd>


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-05-21 20:32
FromVictor Lazzarini
SubjectRe: [Csnd] OSCsend INIT ERROR: creating socket
pushed a fix that looks like it fixes it.
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 21 May 2019, at 20:08, Tarmo Johannes  wrote:
> 
> Hi,
> 
> I made some more tests:
> 
> moving OSCsend to separate instrument ie calling it in separate instances does not make difference. Also it is not the amount of calls that is made at once -  I stopped increasing the amount of adresses and set it to modest 10 (ie a message is sent to 10 addresses 4 times per second) -  the system lasts for longer, but sooner or later still the 
> "Error: ... creating socket" appears.
> 
> Also calling the mySendOsc instrument not in the same time (every instance after 10 k-cyclec) did not make difference.
> 
> My guess is that there is still something in OSCsend that does not close the sockets properly and at some point it hits some limit. OSC_lo works as expected.
> 
> Maybe there is something wrong in my logic or system setup... Please test with the csd attached.
> 
> Thanks!
> tarmo
> 
> -----
> 
> 
> -odac -d
> 
> 
> 
> sr = 44100
> nchnls = 2
> 0dbfs = 1
> ksmps = 32
> 
> ; schedule 1,0,10
> instr 1
> 	kcount init 80
> 	if (metro(4)==1) then
> 		event "i", 2, 0, 0, kcount ; call OSC from different instances
> 		;kcount +=1
> 	endif	
> 	
> endin
> 
> 
> instr 2
> 	icount = p4 ; how many addresses to send the message to
> 	print icount
> 	index = 0
> 	iport = 6006
> 	while index < icount do
> 		Shost sprintfk "127.0.0.%d", 1+(index%64)
> 		schedule "mySendOsc",(index*10)/kr,0.1, Shost,  iport ; do not call in the same time
> 		;schedule "mySendOsc",0,0.1, Shost,  iport ; all in same time
> 		index += 1
> 	od
> 
> endin
> 
> instr mySendOsc
> p3= 0.1
> 	Shost strget p4
> 	iport = p5
> 	OSCsend 1, Shost, iport, "/native", "i", int(random:k(1000,2000))
> 	;OSCsend_lo 1, Shost, iport, "/liblo", "i", int(random:k(10,99))
> 		
> endin
> 
> 
> 
> i 1 0 60
> 
> 
> 
> 
> 
> ----
> 
> 
> 
> 
> Kontakt Oeyvind Brandtsegg () kirjutas kuupäeval T, 21. mai 2019 kell 16:34:
> Hi,
> I haven't run into similar problems,
> but I haven't switched destinations quickly like this.
> However, I can anticipate that there could be an error caused by opening a port, then closing it, and then opening it again, all in quick succession. The port may not have been completely freed immediately when closing it, and then the subsequent attempt to open it would fail. Beware I am just guessing here, but it seems it *could* be an explanation to what you observe.
> Oeyvind
> 
> tir. 21. mai 2019 kl. 14:21 skrev Victor Lazzarini :
> you need separate instances. That's the case for the older version as well. You can't put it in a loop. Needs to be done as a recursive code, if you wish.
> 
> if there is a problem outside a loop, we're happy to look at it. I don't know if there is a time constraint in opening sockets, but I would not think so.
> 
> Oeyvind could also tell us if he ran into similar issues, since he's used these in very challenging setups.
> 
> Note that liblo has not gone away as the listening code uses it.
> 
> Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
> 
> On 21 May 2019, at 12:46, Tarmo Johannes  wrote:
> 
>> Hm,
>> 
>> But if I want to send to different hosts in the same cycle, it should need separate sockets anyway, right? How is it done in the opcode - the socket is opened in init time? When is it closed?
>> 
>> The strange thing is that the error happens after a while as if there were some limit for opening a certain number of sockets?
>> 
>> In another application I try the OSCsend as one call in separate instrument thus it is not run in loop. Still similar Cannot open socket error happens after a while.
>> No problem with liblo version. I would be most happy to get rid of the liblo dependency though...
>> 
>> Tarmo
>> 
>> T, 21. mai 2019 12:33 Victor Lazzarini  kirjutas:
>> Here both OSCSend_lo and OSCSend have issues.
>> 
>> The problem with OSCSend is that you are trying to open the same socket several times, it will never work. It is the same
>> instance of the opcode running initialisation several times. What I can do is prevent that happening (if init is done, then don’t do it again).
>> 
>> Messages are only actually sent at k-time.
>> 
>> ========================
>> Prof. Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy,
>> Maynooth University,
>> Maynooth, Co Kildare, Ireland
>> Tel: 00 353 7086936
>> Fax: 00 353 1 7086952 
>> 
>> > On 21 May 2019, at 09:06, Tarmo Johannes  wrote:
>> > 
>> > Hi,
>> > 
>> > In one application I had problems with Csound native OSCsend (not using liblo) - when sending many messages, at some point it ended with error:
>> > INIT ERROR in instr 3 line 44: creating socket
>> > 
>> > with OSCsend_lo it worked.
>> > 
>> > I made a test csd and discovered that it only happens when OSCsend is called at init time. If it is called at k-time there is no such problem.
>> > 
>> > See the attached file -
>> > instr 3 (OSCsend on init time) fails with around 90..100 calls in the loop.
>> > instr 2 works (both OSCsend and OSCsend_lo called on first k-cycle)
>> > 
>> > I found solution for myself but if there is something to check in the code, maybe it is helpful.
>> > 
>> > Tested on Linux, Csound version 6.13 beta (double samples) May 21 2019
>> > 
>> > tarmo
>> > 
>> > 
>> > Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
>> 
>> 
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> 
> 
> -- 
> 
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
> 
> http://www.partikkelaudio.com/
> http://crossadaptive.hf.ntnu.no
> http://gdsp.hf.ntnu.no/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp
>  
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here 


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-05-21 21:03
FromTarmo Johannes
SubjectRe: [Csnd] OSCsend INIT ERROR: creating socket
AttachmentsNone  None  

Date2019-05-21 21:06
FromVictor Lazzarini
SubjectRe: [Csnd] OSCsend INIT ERROR: creating socket
Thanks for reporting the bug and confirming the fix.
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 21 May 2019, at 21:03, Tarmo Johannes  wrote:
> 
> Fantastic!
> Yes, it works. Thank you so much!
> tarmo
> 
> On May 21 2019, at 10:32 pm, Victor Lazzarini  wrote:
> pushed a fix that looks like it fixes it.
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
> 
> On 21 May 2019, at 20:08, Tarmo Johannes  wrote:
> 
> Hi,
> 
> I made some more tests:
> 
> moving OSCsend to separate instrument ie calling it in separate instances does not make difference. Also it is not the amount of calls that is made at once - I stopped increasing the amount of adresses and set it to modest 10 (ie a message is sent to 10 addresses 4 times per second) - the system lasts for longer, but sooner or later still the
> "Error: ... creating socket" appears.
> 
> Also calling the mySendOsc instrument not in the same time (every instance after 10 k-cyclec) did not make difference.
> 
> My guess is that there is still something in OSCsend that does not close the sockets properly and at some point it hits some limit. OSC_lo works as expected.
> 
> Maybe there is something wrong in my logic or system setup... Please test with the csd attached.
> 
> Thanks!
> tarmo
> 
> -----
> 
> 
> -odac -d
> 
> 
> 
> sr = 44100
> nchnls = 2
> 0dbfs = 1
> ksmps = 32
> 
> ; schedule 1,0,10
> instr 1
> kcount init 80
> if (metro(4)==1) then
> event "i", 2, 0, 0, kcount ; call OSC from different instances
> ;kcount +=1
> endif
> 
> endin
> 
> 
> instr 2
> icount = p4 ; how many addresses to send the message to
> print icount
> index = 0
> iport = 6006
> while index < icount do
> Shost sprintfk "127.0.0.%d", 1+(index%64)
> schedule "mySendOsc",(index*10)/kr,0.1, Shost, iport ; do not call in the same time
> ;schedule "mySendOsc",0,0.1, Shost, iport ; all in same time
> index += 1
> od
> 
> endin
> 
> instr mySendOsc
> p3= 0.1
> Shost strget p4
> iport = p5
> OSCsend 1, Shost, iport, "/native", "i", int(random:k(1000,2000))
> ;OSCsend_lo 1, Shost, iport, "/liblo", "i", int(random:k(10,99))
> 
> endin
> 
> 
> 
> i 1 0 60
> 
> 
> 
> 
> 
> ----
> 
> 
> 
> 
> Kontakt Oeyvind Brandtsegg () kirjutas kuupäeval T, 21. mai 2019 kell 16:34:
> Hi,
> I haven't run into similar problems,
> but I haven't switched destinations quickly like this.
> However, I can anticipate that there could be an error caused by opening a port, then closing it, and then opening it again, all in quick succession. The port may not have been completely freed immediately when closing it, and then the subsequent attempt to open it would fail. Beware I am just guessing here, but it seems it *could* be an explanation to what you observe.
> Oeyvind
> 
> tir. 21. mai 2019 kl. 14:21 skrev Victor Lazzarini :
> you need separate instances. That's the case for the older version as well. You can't put it in a loop. Needs to be done as a recursive code, if you wish.
> 
> if there is a problem outside a loop, we're happy to look at it. I don't know if there is a time constraint in opening sockets, but I would not think so.
> 
> Oeyvind could also tell us if he ran into similar issues, since he's used these in very challenging setups.
> 
> Note that liblo has not gone away as the listening code uses it.
> 
> Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
> 
> On 21 May 2019, at 12:46, Tarmo Johannes  wrote:
> 
> Hm,
> 
> But if I want to send to different hosts in the same cycle, it should need separate sockets anyway, right? How is it done in the opcode - the socket is opened in init time? When is it closed?
> 
> The strange thing is that the error happens after a while as if there were some limit for opening a certain number of sockets?
> 
> In another application I try the OSCsend as one call in separate instrument thus it is not run in loop. Still similar Cannot open socket error happens after a while.
> No problem with liblo version. I would be most happy to get rid of the liblo dependency though...
> 
> Tarmo
> 
> T, 21. mai 2019 12:33 Victor Lazzarini  kirjutas:
> Here both OSCSend_lo and OSCSend have issues.
> 
> The problem with OSCSend is that you are trying to open the same socket several times, it will never work. It is the same
> instance of the opcode running initialisation several times. What I can do is prevent that happening (if init is done, then don’t do it again).
> 
> Messages are only actually sent at k-time.
> 
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
> 
> On 21 May 2019, at 09:06, Tarmo Johannes  wrote:
> 
> Hi,
> 
> In one application I had problems with Csound native OSCsend (not using liblo) - when sending many messages, at some point it ended with error:
> INIT ERROR in instr 3 line 44: creating socket
> 
> with OSCsend_lo it worked.
> 
> I made a test csd and discovered that it only happens when OSCsend is called at init time. If it is called at k-time there is no such problem.
> 
> See the attached file -
> instr 3 (OSCsend on init time) fails with around 90..100 calls in the loop.
> instr 2 works (both OSCsend and OSCsend_lo called on first k-cycle)
> 
> I found solution for myself but if there is something to check in the code, maybe it is helpful.
> 
> Tested on Linux, Csound version 6.13 beta (double samples) May 21 2019
> 
> tarmo
> 
> 
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> 
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
> https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> 
> 
> --
> 
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
> 
> http://www.partikkelaudio.com/
> http://crossadaptive.hf.ntnu.no
> http://gdsp.hf.ntnu.no/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp
> 
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here 
> 
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
> https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here